diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 84d73b1a2..924971bd2 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -29,7 +29,7 @@ echo(""); echo("
");
- echo($imgfile . "\n" . $opts);
-
-
- $cmd = "/usr/bin/rrdtool";
-
- `rm /tmp/poo`;
- $handle = fopen("/tmp/poo", "w");
- fwrite($handle, " graph test.png " . $opts);
-
- if (( $fh = popen($cmd, 'r')) === false)
- die("Open failed : ${php_errormsg}\n");
-
- fwrite($fh, " graph $imgfile " . $opts);
-
-
- pclose($fh);
-
-
-
- echo`$rrdtool graph $imgfile $opts`;
-
-
-# $ret = rrd_graph("$imgfile", $opts, count($opts));
-
-# if( !is_array($ret) )
-# {
- # $err = rrd_error();
-# echo "rrd_graph() ERROR: $err\n";
-# if ( !is_file($installdir . $imgfile) ) {
-# return FALSE;
-# } else {
- return $imgfile;
-# }
-
-}
-
-
-
function graph_device_bits ($device, $graph, $from, $to, $width, $height)
{
global $rrdtool, $installdir, $mono_font, $rrd_dir;
@@ -137,7 +52,7 @@ function graph_device_bits ($device, $graph, $from, $to, $width, $height)
$hostname = gethostbyid($device);
- $query = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `host` = '$device' AND ifType LIKE '%ethernet%' OR `ifType` LIKE '%erial%'");
+ $query = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `host` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%'");
while($int = mysql_fetch_row($query)) {
diff --git a/poll-device.php b/poll-device.php
index ca7746504..12e12a182 100755
--- a/poll-device.php
+++ b/poll-device.php
@@ -184,10 +184,6 @@ while ($device = mysql_fetch_array($device_query)) {
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Changed hardware from $hardware to $newhardware')");
}
- if ( $newuptime && $uptime != $newuptime ) {
- $update .= $seperator . "`uptime` = '$newuptime'";
- $seperator = ", ";
- }
if( $status != $newstatus ) {
$update .= $seperator . "`status` = '$newstatus'";
@@ -201,7 +197,14 @@ while ($device = mysql_fetch_array($device_query)) {
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Device status changed to $stat')");
}
- if ( $newuptime ) {
+ if ($newuptime) {
+ echo("Uptime : $newuptime\n");
+
+ $update_uptime_attrib = mysql_query("UPDATE devices_attribs SET attrib_value = '$newuptime' WHERE `device_id` = '$id' AND `attrib_type` = 'uptime'");
+ if(mysql_affected_rows() == '0') {
+ $insert_uptime_attrib = mysql_query("INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('$id', 'uptime', '$newuptime')");
+ }
+
$update_uptime = mysql_query("UPDATE device_uptime SET device_uptime = '$newuptime' WHERE `device_id` = '$id'");
if(mysql_affected_rows() == '0') {
$insert_uptime = mysql_query("INSERT INTO device_uptime (`device_uptime`, `device_id`) VALUES ('$newuptime','$id')");