diff options
Diffstat (limited to 'net/rtg/files/patch-etc_95.pl')
-rw-r--r-- | net/rtg/files/patch-etc_95.pl | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/net/rtg/files/patch-etc_95.pl b/net/rtg/files/patch-etc_95.pl index f780a3e8e57c..68240e611394 100644 --- a/net/rtg/files/patch-etc_95.pl +++ b/net/rtg/files/patch-etc_95.pl @@ -1,4 +1,4 @@ ---- etc/95.pl.orig 2016-11-04 16:36:01 UTC +--- etc/95.pl.orig 2018-04-02 20:14:41 UTC +++ etc/95.pl @@ -31,7 +31,7 @@ $pass="rtgdefault"; $onedaysec=60*60*24; @@ -9,3 +9,52 @@ foreach $conf (@configs) { if (open CONF, "<$conf") { print "Reading [$conf].\n" if $DEBUG; +@@ -207,13 +207,13 @@ print "Period: [", format_dt($startdate) + write; + ($name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout) = ("Connection", "", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps"); + write; +-print "--------------------------------------------------------------------------------\n"; ++print "----------------------------------------------------------------------------------------------------\n"; + + $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass); + $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass); +-$range="dtime>$startdate and dtime<=$enddate"; ++$range="`dtime`>$startdate AND `dtime`<=$enddate"; + +-$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\""; ++$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\""; + $sth = $dbh->prepare($statement) + or die "Can't prepare $statement: $dbh->errstr\n"; + $rv = $sth->execute +@@ -223,19 +223,19 @@ while (@row = $sth->fetchrow_array ()) { + } + + foreach $interface (@interfaces) { +- $statement="SELECT rid, name, speed FROM interface WHERE id=$interface"; ++ $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface"; + &run_query($statement); + ($rid, $name, $speed) = @row; + +- $statement="SELECT rid, name FROM router WHERE rid=$rid"; ++ $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid"; + &run_query($statement); + ($rid, $router) = @row; + +- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; ++ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; + ($intbytes_in, $maxin, $avgin, $nfin) = &interface_stats($statement); + $bytesin = int($intbytes_in/1000000 + .5); + +- $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; ++ $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; + ($intbytes_out, $maxout, $avgout, $nfout) = &interface_stats($statement); + $bytesout = int($intbytes_out/1000000 + .5); + +@@ -279,6 +279,6 @@ $rc = $dbh->disconnect; + exit; + + format STDOUT = +-@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>>> @>>>>>> ++@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>>> @>>>>>> + $name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout + . |