| Rev 11 |
|
Rev 12 |
| Line 16... |
|
Line 16... |
#$temp = "/opt/HotSaNIC/modules/crusader/temp.txt"; |
|
#$temp = "/opt/HotSaNIC/modules/crusader/temp.txt"; |
#open (TEMPFILE,">$temp"); |
|
#open (TEMPFILE,">$temp"); |
#open (STDERR,">&TEMPFILE") || die ("open STDERR failed"); |
|
#open (STDERR,">&TEMPFILE") || die ("open STDERR failed"); |
#open (STDOUT,">&TEMPFILE") || die ("open STDOUT failed"); |
|
#open (STDOUT,">&TEMPFILE") || die ("open STDOUT failed"); |
|
|
|
#print "l1 ahoj \n"; |
|
|
|
|
|
my %args=@_; |
|
my %args=@_; |
|
|
|
$mtime=(stat("rrd"))[9]; |
|
$mtime=(stat("rrd"))[9]; |
$now=time; |
|
$now=time; |
|
|
|
utime $now,$now,"rrd"; |
|
utime $now,$now,"rrd"; |
| |
|
|
| |
|
$IWCONF = $args{IWCONFIG}; |
| |
|
$IWLIST = $args{IWLIST}; |
| |
|
$hostap = $args{HOSTAP}; |
| |
|
|
|
|
|
my @IFACES=(); |
|
my @IFACES=(); |
| |
|
my @IFMACS=(); |
|
|
|
foreach (keys(%args)) { |
|
foreach (keys(%args)) { |
if (index($_,"IFACE:") >=0 ) { |
|
if (index($_,"DEVICE:") >=0 ) { |
(undef,$device)=split /:/; |
|
(undef,$device)=split /:/; |
push @IFACES,$device; |
|
push @IFACES,$device; |
} |
|
} |
} |
|
} |
|
|
foreach (keys(%args)) { |
| |
|
if (index($_,"MAC,") >=0 ) { |
| |
|
(undef,$dev,$mac)=split /,/; |
| |
|
push @IFMACS,"$dev,$mac"; |
| |
|
} |
| |
|
} |
|
|
|
foreach $device (@IFACES) { |
|
foreach $device (@IFACES) { |
my $rate = 0; |
|
my $rate = 0; |
my $quality = 0; |
|
my $tempin = 0; |
my $signal = 0; |
|
my $signal = 0; |
my $noise = 0; |
|
my $noise = 0; |
my $mode = 0; |
|
my $mode = 0; |
|
|
|
$command = "/opt/HotSaNIC/modules/crusader/crgetsig"; |
|
|
$command = "cat /tmp/crusader.txt"; |
|
$command = "cat /tmp/crusader.txt"; |
open (FILE,"$command|"); |
|
open (FILE,"$command|"); |
while(<FILE>) { |
|
while(<FILE>) { |
$var=$_; |
|
$var=$_; |
if ($var =~ /^\+ (.*) #.*/) { |
|
#print "line: $_\n"; |
$signal = $1; |
|
if ($var =~ /^(\d*)\s*(\d*)\s*(\d*)\s*(\d*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)\s*([\w\.]*)/) { |
} |
|
$signal = $2; |
} |
|
$tempin = $9 * 10; |
| |
|
#print "signal: $signal\n"; |
| |
|
#print "tempin: $tempin\n"; |
| |
|
} |
| |
|
} # while |
close(FILE); |
|
close(FILE); |
$rate=$rate*1; |
|
$rate=$rate*1; |
print "l1 $device $signal \n"; |
|
|
|
|
|
if ( ! -e "rrd/$device.rrd" ) { system("./makerrd","$device","U") } |
|
if ( ! -e "rrd/$device.rrd" ) { system("./makerrd","$device","U") } |
RRDs::update "rrd/$device.rrd",time.":".$rate.":".$quality.":".$signal.":".$noise; |
|
RRDs::update "rrd/$device.rrd",time.":".$rate.":".$tempin.":".$signal.":".$noise; |
if ($ERROR = RRDs::error) { print time," ",$MODNAME,": unable to update `$device.rrd': $ERROR"; } |
|
if ($ERROR = RRDs::error) { print time," ",$MODNAME,": unable to update `$device.rrd': $ERROR"; } |
| |
|
} # foreach |
|
|
|
} |
|
|
#uncomment this for debug output to temp.txt |
|
#uncomment this for debug output to temp.txt |
#all print will be done into the file |
|
#all print will be done into the file |
# close (TEMPFILE); |
|
# close (TEMPFILE); |
# close (STDERR); |
|
# close (STDERR); |
# close (STDOUT); |
|
# close (STDOUT); |