jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [traffic/] [platform/] [sysrrcp.pm] - Diff between revs 1 and 2

Show entire file Ignore whitespace

Rev 1 Rev 2
Line 30... Line 30...
   
$res=`$rtlbin $com-$host\@eth0 counters | grep ^eth | sed 's/://g' | sed 's/eth0\\///g'`; $res=`$rtlbin $com-$host\@eth0 counters | grep ^eth | sed 's/://g' | sed 's/eth0\\///g'`;
#print "tu je res \n$res \n"; #print "tu je res \n$res \n";
@pole_res = split("\n",$res); @pole_res = split("\n",$res);
$pocet = scalar(@pole_res); $pocet = scalar(@pole_res);
print "Vysledek pro $_ je dlouhy $pocet \n"; # print "Vysledek pro $_ je dlouhy $pocet \n";
#vytvoreni asociativniho pole $nics s cislem portu a rychlostma #vytvoreni asociativniho pole $nics s cislem portu a rychlostma
   
for (@{$targets{$_}}) { for (@{$targets{$_}}) {
print "0b $_\n"; # print "0b $_\n";
if($i == 0) { if($i == 0) {
$nics{$_} = 0; $nics{$_} = 0;
$lastnic = $_; $lastnic = $_;
$i++; $i++;
} else { } else {
$nics{$lastnic} = $_; $nics{$lastnic} = $_;
$i = 0; $i = 0;
} }
} # for } # for
   
print "3 $host a $com b $lastnic\n"; # print "3 $host a $com b $lastnic\n";
   
foreach $port (keys(%nics) ){ foreach $port (keys(%nics) ){
print "3be $host $com $port $nics{$port}\n"; # print "3be $host $com $port $nics{$port}\n";
my $resfound = 0; my $resfound = 0;
my $rx = 0; my $rx = 0;
my $tx = 0; my $tx = 0;
#projdeme vysledek a pokud najdeme hodnoty pro port tak zapisem do rrd #projdeme vysledek a pokud najdeme hodnoty pro port tak zapisem do rrd
foreach $linka (@pole_res) { foreach $linka (@pole_res) {
Line 61... Line 61...
$resrx = $polozky[1]; $resrx = $polozky[1];
$restx = $polozky[2]; $restx = $polozky[2];
   
if ($port == $resport) { if ($port == $resport) {
$resfound = 1; $resfound = 1;
print "Pro $port je $resrx a $restx\n"; # print "Pro $port je $resrx a $restx\n";
$rx = $resrx; $rx = $resrx;
$tx = $restx; $tx = $restx;
} }
} # foreach line in result } # foreach line in result
   
Line 73... Line 73...
   
if ($resfound == 1) { if ($resfound == 1) {
do_rrd($host."_".$port, $rx, $tx, $nics{$port}); do_rrd($host."_".$port, $rx, $tx, $nics{$port});
   
} else { } else {
print "tady to je kdyz nejni spojeni tak se do rrd da undef\n"; # print "tady to je kdyz nejni spojeni tak se do rrd da undef\n";
do_rrd($host."_".$port, "U", "U", $nics{$port}); do_rrd($host."_".$port, "U", "U", $nics{$port});
} }
} # foreach port } # foreach port
} # foreach } # foreach
} # sub } # sub

Powered by WebSVN 2.2.1