From 94381f9d4ff955d87583ed22c4a0284d7713f175 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Fri, 1 May 2015 17:46:58 +0200 Subject: [PATCH 1/3] Add temp polling for IBM Flexsystem switches - Able to poll temps from IBM Flexsystem switches - Convert temp response to digit --- .../discovery/temperatures/ibmnos.inc.php | 26 +++++++++++++++++++ includes/polling/functions.inc.php | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 includes/discovery/temperatures/ibmnos.inc.php diff --git a/includes/discovery/temperatures/ibmnos.inc.php b/includes/discovery/temperatures/ibmnos.inc.php new file mode 100644 index 0000000000..26e500f105 --- /dev/null +++ b/includes/discovery/temperatures/ibmnos.inc.php @@ -0,0 +1,26 @@ + $descr) { + $oids = snmp_get($device, $obj, "-OsqnU", ""); + list(,$current) = explode(' ',$oids); + $index = $obj; + $divisor = "1"; + $multiplier = "1"; + $type = "ibmnos"; + discover_sensor($valid['sensor'], 'temperature', $device, $obj, $index, $type, $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current); + } + } + } diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 63d6b53868..d2cc571618 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -17,6 +17,8 @@ function poll_sensor($device, $class, $unit) { if ($debug) echo("Attempt $i "); $sensor_value = trim(str_replace("\"", "", snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB"))); + preg_match("/[\d\.]+/",$sensor_value,$temp_response); + $sensor_value = $temp_response[0]; if (is_numeric($sensor_value) && $sensor_value != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update; sleep(1); # Give the TME some time to reset From 92b9865f275ed0a95bd3962832a9099f6ac8fd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Rosiak?= Date: Sat, 2 May 2015 12:24:09 +0200 Subject: [PATCH 2/3] Update ibmnos.inc.php - Updated to fit suggestions from scrut --- includes/discovery/temperatures/ibmnos.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/temperatures/ibmnos.inc.php b/includes/discovery/temperatures/ibmnos.inc.php index 26e500f105..f339dff452 100644 --- a/includes/discovery/temperatures/ibmnos.inc.php +++ b/includes/discovery/temperatures/ibmnos.inc.php @@ -1,7 +1,7 @@ Date: Sun, 3 May 2015 14:33:33 +0200 Subject: [PATCH 3/3] Update functions.inc.php - Add extra safety check --- includes/polling/functions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index d2cc571618..ca9b767a1d 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -18,7 +18,9 @@ function poll_sensor($device, $class, $unit) if ($debug) echo("Attempt $i "); $sensor_value = trim(str_replace("\"", "", snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB"))); preg_match("/[\d\.]+/",$sensor_value,$temp_response); - $sensor_value = $temp_response[0]; + if (!empty($temp_response[0])) { + $sensor_value = $temp_response[0]; + } if (is_numeric($sensor_value) && $sensor_value != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update; sleep(1); # Give the TME some time to reset