jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [apcusv/] [platform/] [default.pm] - Blame information for rev 33

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::OSdep;
2 
3use lib "../../lib";
4 
5sub version {
6 ($VERSION = '$Revision: 1.9 $') =~ s/.*(\d+\.\d+).*/$1/;
7 return "default.pm $VERSION";
8 }
9 
10sub sample {
11 
12 my %args=@_;
13 my ($loadpct,$bcharge,$timeleft,$outputv,$itemp,$battv)=("nan","nan","nan","nan","nan","nan");
14 my ($onbatt,$replacebatt)=(-1,-1);
15 
16 open FILE,"$args{APCACCESS}|" || HotSaNIClog::error("unable to run '$args{APCACCESS}': $!");
17 while (<FILE>) {
18 chomp;
19 ($name,$value,undef)=split / *: */;
20 ($firstvalue = $value) =~ s/ .*$//g;
21 if ($name eq "LOADPCT") { $loadpct=$firstvalue; }
22 if (($name eq "BCHARGE") || ($name eq "BATTPCT")) { $bcharge=$firstvalue; }
23 if ($name eq "TIMELEFT") { $timeleft=$firstvalue; }
24 if (($name eq "OUTPUTV") || ($name eq "OUTVOLT")) { $outputv=$firstvalue; }
25 if (($name eq "ITEMP") || ($name eq "UPSTEMP")) { $itemp=$firstvalue; }
26 if (($name eq "BATTV") || ($name eq "BATTVOLT")) { $battv=$firstvalue; }
27 if ($name eq "STATUS") {
28 if (index ($value,"ONBATT") >= 0 ) { $onbatt=1; }
29 if (index ($value,"REPLACEBATT") >= 0 ) { $replacebatt=1; }
30 }
31 }
32 close FILE;
33 
34 HotSaNICmod::do_rrd("usv","U",time,$loadpct,$bcharge,$timeleft,$outputv,$itemp,$battv,$onbatt,$replacebatt);
35 }
36 
371;
38 
39 

Powered by WebSVN 2.2.1