From d33dfc87a1c2c554337bf31a5fa8ccc90c150325 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sat, 12 Jun 2010 18:14:59 +0000 Subject: [PATCH] fix load graph (fixed per-os specific graphs for device-level graphs *only*) git-svn-id: http://www.observium.org/svn/observer/trunk@1157 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/graph.php | 1 + includes/polling/device-unix.inc.php | 2 +- includes/polling/ports.inc.php | 3 ++- includes/polling/processors.inc.php | 2 +- poll-device.php | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/html/graph.php b/html/graph.php index a634b9833..3094e6a0d 100644 --- a/html/graph.php +++ b/html/graph.php @@ -21,6 +21,7 @@ if($_GET['debug']) { if($_GET['device']) { $_GET['id'] = $_GET['device']; + $device_id = $_GET['device']; } elseif($_GET['if']) { $_GET['id'] = $_GET['if']; } elseif($_GET['port']) { diff --git a/includes/polling/device-unix.inc.php b/includes/polling/device-unix.inc.php index 0ae9c9af5..c40db9d6d 100755 --- a/includes/polling/device-unix.inc.php +++ b/includes/polling/device-unix.inc.php @@ -29,8 +29,8 @@ else if(strstr($sysDescr, "sparc64")) { $hardware = "Generic SPARC 64-bit"; } $cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111"; $features = trim(`$cmd`); - $features = str_replace("No Such Object available on this agent at this OID", "", $features); $features = str_replace("\"", "", $features); + if(preg_match("@No\ Such@", $features)||preg_match("@No\ such@", $features)) { unset($features); } // Detect Dell hardware via OpenManage SNMP $cmd = $config['snmpget'] . " -m MIB-Dell-10892 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.674.10892.1.300.10.1.9.1"; $hw = trim(str_replace("\"", "", `$cmd`)); diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 0ab72c065..6fa95920b 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -122,9 +122,10 @@ if($port[$oid]) { $oid_diff = $this_port[$oid] - $port[$oid]; $oid_rate = $oid_diff / $polled_period; + if($oid_rate < 0) { $oid_rate = "0"; } $update .= ", `".$oid."_rate` = '".$oid_rate."'"; $update .= ", `".$oid."_delta` = '".$oid_diff."'"; - #echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); + if($debug) {echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n");} } } diff --git a/includes/polling/processors.inc.php b/includes/polling/processors.inc.php index 351e4cbd8..1a18d71c0 100755 --- a/includes/polling/processors.inc.php +++ b/includes/polling/processors.inc.php @@ -28,7 +28,7 @@ while($processor = mysql_fetch_array($proc_data)) { } $proc = trim(str_replace("\"", "", $proc)); - list($proc) = split(" ", $proc); + list($proc) = preg_split("@\ @", $proc); echo($proc . "%\n"); diff --git a/poll-device.php b/poll-device.php index eca430419..14d0c513e 100755 --- a/poll-device.php +++ b/poll-device.php @@ -211,7 +211,7 @@ while ($device = mysql_fetch_array($device_query)) { eventlog("OS Version -> $version", $device['device_id']); } - if ( $features && $features != $device['features'] ) { + if ( $features != $device['features'] ) { $poll_update .= $poll_separator . "`features` = '$features'"; $poll_separator = ", "; eventlog("OS Features -> $features", $device['device_id']);