From 20c2f225c90aa6c7b901c63a7888780e544eee02 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 4 May 2011 13:22:41 +0000 Subject: [PATCH] fix temperatures i think. git-svn-id: http://www.observium.org/svn/observer/trunk@2239 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../discovery/cisco-entity-sensor.inc.php | 8 ++--- includes/discovery/entity-sensor.inc.php | 10 +++--- includes/discovery/functions.inc.php | 34 +++++++++---------- includes/discovery/ipmi.inc.php | 2 -- includes/discovery/sensors.inc.php | 2 ++ 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php index 05329c380..927fd1c4a 100644 --- a/includes/discovery/cisco-entity-sensor.inc.php +++ b/includes/discovery/cisco-entity-sensor.inc.php @@ -1,13 +1,11 @@ "0") { $divisor = $divisor . str_pad('', $entry['entPhySensorPrecision'], "0"); } $current = $current * $multiplier / $divisor; - if ($type == "temperature") { if ($current > "200"){ $valid = FALSE; } $descr = preg_replace("/[T|t]emperature[|s]/", "", $descr); } + if ($type == "temperature") { if ($current > "200"){ $thisisnotbullshit = FALSE; } $descr = preg_replace("/[T|t]emperature[|s]/", "", $descr); } #echo($descr . "|" . $index . "|" .$current . "|" . $multiplier . "|" . $divisor ."|" . $entry['entPhySensorScale'] . "|" . $entry['entPhySensorPrecision'] . "\n"); - if ($current == "-127") { $valid = FALSE; } + if ($current == "-127") { $thisisnotbullshit = FALSE; } - if ($valid && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0") + if ($thisisnotbullshit && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0") ## Check to make sure we've not already seen this sensor via cisco's entity sensor mib { discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current); diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 6b7bef3b3..2990e1b70 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -1,7 +1,7 @@ " . $type . "\n"); } - if (!$this_valid[$class][$type][$index]) + if (!$valid[$class][$type][$index]) { echo("-"); mysql_query("DELETE FROM `sensors` WHERE sensor_class='".$class."' AND sensor_id = '" . $test['sensor_id'] . "'"); @@ -161,7 +161,7 @@ function check_valid_sensors($device, $class, $this_valid) } } -function discover_juniAtmVp(&$this_valid, $interface_id, $vp_id, $vp_descr) +function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr) { global $config, $debug; @@ -177,7 +177,7 @@ function discover_juniAtmVp(&$this_valid, $interface_id, $vp_id, $vp_descr) { echo("."); } - $this_valid[$interface_id][$vp_id] = 1; + $valid[$interface_id][$vp_id] = 1; } function discover_link($local_interface_id, $protocol, $remote_interface_id, $remote_hostname, $remote_port, $remote_platform, $remote_version) @@ -210,7 +210,7 @@ function discover_link($local_interface_id, $protocol, $remote_interface_id, $re $link_exists[$local_interface_id][$remote_hostname][$remote_port] = 1; } -function discover_storage(&$this_valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL) +function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL) { global $config, $debug; @@ -233,12 +233,12 @@ function discover_storage(&$this_valid, $device, $index, $type, $mib, $descr, $s mysql_query($query); if ($debug) { print $query . "\n"; } } - $this_valid[$mib][$index] = 1; + $valid[$mib][$index] = 1; } } -function discover_processor(&$this_valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL) +function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL) { global $config, $debug; @@ -263,12 +263,12 @@ function discover_processor(&$this_valid, $device, $oid, $index, $type, $descr, mysql_query($query); if ($debug) { print $query . "\n"; } } - $this_valid[$type][$index] = 1; + $valid[$type][$index] = 1; } } -function discover_mempool(&$this_valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL) +function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL) { global $config, $debug; @@ -293,11 +293,11 @@ function discover_mempool(&$this_valid, $device, $index, $type, $descr, $precisi mysql_query($query); if ($debug) { print $query . "\n"; } } - $this_valid[$type][$index] = 1; + $valid[$type][$index] = 1; } } -function discover_toner(&$this_valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL) +function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL) { global $config, $debug; @@ -324,10 +324,10 @@ function discover_toner(&$this_valid, $device, $oid, $index, $type, $descr, $cap echo("U"); } } - $this_valid[$type][$index] = 1; + $valid[$type][$index] = 1; } -function discover_process_ipv6(&$this_valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin) +function discover_process_ipv6(&$valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin) { global $device,$config; @@ -370,8 +370,8 @@ function discover_process_ipv6(&$this_valid, $ifIndex,$ipv6_address,$ipv6_prefix echo("."); } $full_address = "$ipv6_address/$ipv6_prefixlen"; - $this_valid_address = $full_address . "-" . $interface_id; - $this_valid['ipv6'][$this_valid_address] = 1; + $valid_address = $full_address . "-" . $interface_id; + $valid['ipv6'][$valid_address] = 1; } } diff --git a/includes/discovery/ipmi.inc.php b/includes/discovery/ipmi.inc.php index 238128e18..18efa1529 100644 --- a/includes/discovery/ipmi.inc.php +++ b/includes/discovery/ipmi.inc.php @@ -1,7 +1,5 @@