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(""); if($speed && $speed != "") { echo("$speed"); } - echo(""); + echo(""); if($iftype && $iftype != "") { echo("$iftype"); } else { echo("-"); } echo(""); if($mac && $mac != "") { echo("$mac"); } else { echo("-"); } diff --git a/html/pages/addsrv.php b/html/pages/addsrv.php index 43b2e6f6d..0a2ed8c67 100644 --- a/html/pages/addsrv.php +++ b/html/pages/addsrv.php @@ -12,7 +12,7 @@ if($_POST['addsrv']) { if ($handle = opendir($installdir . "/includes/services/")) { while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { + if ($file != "." && $file != ".." && !strstr($file, ".")) { $servicesform .= ""; } } diff --git a/includes/graphing.php b/includes/graphing.php index 8d5521c1a..f8bf587c8 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -40,91 +40,6 @@ function temp_graph ($device, $graph, $from, $to, $width, $height, $title, $vert } } -function graph_global_bits ($graph, $from, $to, $width, $height) { - - global $rrdtool, $installdir, $mono_font, $rrd_dir; - $imgfile = "graphs/" . $graph; - $opts = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; - - $query = mysql_query("SELECT `ifIndex`, I.id as id, D.hostname FROM `interfaces` AS I, `devices` AS D WHERE I.host = D.id AND I.iftype LIKE '%ethernet%'"); - - while($int = mysql_fetch_row($query)) { - $hostname = $int[2]; - $id = $int[1]; - if(is_file($rrd_dir . "/" . $hostname . "." . $int[0] . ".rrd")) { - $opts .= "DEF:inoctets" . $int[1] . "=" . $rrd_dir . "/" . $hostname . "." . $int[0] . ".rrd:INOCTETS:AVERAGE \ -DEF:outoctets" . $int[1] . "=" . $rrd_dir . "/" . $hostname . "." . $int[0] . ".rrd:OUTOCTETS:AVERAGE \ -"; - $in_thing .= $seperator . "inoctets" . $int[1] . ",UN,0," . "inoctets" . $int[1] . ",IF"; - $out_thing .= $seperator . "outoctets" . $int[1] . ",UN,0," . "outoctets" . $int[1] . ",IF"; - $pluses .= $plus; - $seperator = ","; - $plus = ",+"; - } - } - - $opts .= " CDEF:inoctets=" . $in_thing . $pluses . " \ - CDEF:outoctets=" . $out_thing . $pluses . " \ - CDEF:doutoctets=outoctets,-1,* \ - CDEF:inbits=inoctets,8,* \ - CDEF:outbits=outoctets,8,* \ - CDEF:doutbits=doutoctets,8,* \ - AREA:inbits#CDEB8B: \ - COMMENT:BPS Current Average Max 95th %\\n \ - LINE1.25:inbits#006600:In \ - GPRINT:inbits:LAST:%6.2lf%s \ - GPRINT:inbits:AVERAGE:%6.2lf%s \ - GPRINT:inbits:MAX:%6.2lf%s\l \ - AREA:doutbits#C3D9FF: \ - LINE1.25:doutbits#000099:Out \ - GPRINT:outbits:LAST:%6.2lf%s \ - GPRINT:outbits:AVERAGE:%6.2lf%s \ - GPRINT:outbits:MAX:%6.2lf%s "; - - - if($width <= '300') { - $opts .= " --font LEGEND:7:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; - } - - 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')");