jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-jablonecka/] [modules/] [sensors/] [platform/] [freebsd.pm] - Blame information for rev 34

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::OSdep;
2 
3use RRDs;
4 
5sub version {
6 ($VERSION = '$Revision: 1.4 $') =~ s/.*(\d+\.\d+).*/$1/;
7 return "$^O.pm $VERSION";
8 }
9 
10sub sample {
11 my %args=@_;
12 
13 @readings = `/usr/local/bin/mbmon -rc1`
14 or print time," ",$args{MODNAME},": Unable to run /usr/local/bin/mbmon.\n";
15 
16 foreach (keys(%args)) {
17 if (index($_,"SENSOR") >= 0 ) {
18 ($undef,$dev)=split(/,/,$args{$_});
19 
20 foreach(@readings){
21 # force it to scalar just in case
22 if(/$dev\s+:\s+(.*)/i){ $value = $1;$value++;$value--; }
23 }
24 
25 # build new database if needed
26 if ( ! -e "rrd/$dev.rrd" ) { system("./makerrd","$dev","10000") }
27 
28 # update database
29 RRDs::update "rrd/$dev.rrd",time.":".$value;
30 if ($ERROR = RRDs::error) { print time," ",$args{MODNAME},": unable to update `$dev.rrd': $ERROR\n"; }
31 }
32 }
33 }
34 
351;
36 

Powered by WebSVN 2.2.1