package HotSaNICmod::OSdep; use RRDs; sub version { ($VERSION = '$Revision: 1.0 $') =~ s/.*(\d+\.\d+).*/$1/; my $platform; foreach (keys(%INC)) { $platform=$_ if $_ =~ /platform/; } return "$platform $VERSION"; } sub sample { #uncomment this for debug output to temp.txt #all print will be done into the file #$temp = "/opt/HotSaNIC/modules/crusader/temp.txt"; #open (TEMPFILE,">$temp"); #open (STDERR,">&TEMPFILE") || die ("open STDERR failed"); #open (STDOUT,">&TEMPFILE") || die ("open STDOUT failed"); my %args=@_; $mtime=(stat("rrd"))[9]; $now=time; utime $now,$now,"rrd"; $IWCONF = $args{IWCONFIG}; $IWLIST = $args{IWLIST}; $hostap = $args{HOSTAP}; my @IFACES=(); my @IFMACS=(); foreach (keys(%args)) { if (index($_,"IFACE:") >=0 ) { (undef,$device)=split /:/; push @IFACES,$device; } } foreach (keys(%args)) { if (index($_,"MAC,") >=0 ) { (undef,$dev,$mac)=split /,/; push @IFMACS,"$dev,$mac"; } } foreach $device (@IFACES) { my $power = 0; my $tempin = 0; my $signal = 0; my $voltage = 0; $command = "cat /tmp/crusader.txt"; open (FILE,"$command|"); while() { $var=$_; print "line: $_\n"; if ($var =~ /^(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)/) { $signal = $2; $power = $5 * 10; $voltage = $7 * 10; $tempin = $9 * 10; #print "signal: $signal\n"; #print "tempin: $tempin\n"; } } # while close(FILE); if ( ! -e "rrd/$device.rrd" ) { system("./makerrd","$device","U") } RRDs::update "rrd/$device.rrd",time.":".$power.":".$tempin.":".$signal.":".$voltage; if ($ERROR = RRDs::error) { print time," ",$MODNAME,": unable to update `$device.rrd': $ERROR"; } } # foreach #uncomment this for debug output to temp.txt #all print will be done into the file # close (TEMPFILE); # close (STDERR); # close (STDOUT); } 1; WebSVN - hotsanic - Blame - Rev 23 - /trunk/modules/crusader/platform/default.pm
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [crusader/] [platform/] [default.pm] - Blame information for rev 23

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1