From f8b795ec95238af5ed9279e231148fb107347dc4 Mon Sep 17 00:00:00 2001 From: Tom Sealey Date: Sat, 29 Jul 2017 11:20:36 +0100 Subject: [PATCH] newdevice: Removed check for switch model or firmware version for Avaya ERS switches * Added mempool support for Avaya ERS 3500 * Added mempool support for Avaya ERS 3500 * removed check for firmware version * removed check for switch model or firmware version * removed check for switch model or firmware version * removed check for switch model or firmware version * adding @laf suggested changes * made changes as suggested by @laf * removed blank line * removed blank line * added the snmpwalk back need this, or it's pointless --- includes/discovery/mempools/avaya-ers.inc.php | 23 +++++------------ .../discovery/processors/avaya-ers.inc.php | 16 +++++------- .../sensors/temperature/avaya-ers.inc.php | 25 ++++++------------- includes/polling/mempools/avaya-ers.inc.php | 15 +++++------ 4 files changed, 26 insertions(+), 53 deletions(-) diff --git a/includes/discovery/mempools/avaya-ers.inc.php b/includes/discovery/mempools/avaya-ers.inc.php index f43dc28abe..eba862f67e 100644 --- a/includes/discovery/mempools/avaya-ers.inc.php +++ b/includes/discovery/mempools/avaya-ers.inc.php @@ -3,24 +3,13 @@ $OID = '.1.3.6.1.4.1.45.1.6.3.8.1.1.12'; if ($device['os'] == 'avaya-ers') { - // Memory information only known to work with 5500 and 5600 switches - if (preg_match('/5[56][0-9][0-9]/', $device['sysDescr'])) { - // Get major version number of running firmware - $fw_major_version = null; - preg_match('/[0-9]\.[0-9]/', $device['version'], $fw_major_version); - $fw_major_version = $fw_major_version[0]; + $mem = snmp_walk($device, $OID, '-Osqn'); - // Temperature info only known to be present in firmware 6.1 or higher - if ($fw_major_version >= 6.1) { - $mem = snmp_walk($device, $OID, '-Osqn'); + echo "$mem\n"; - echo "$mem\n"; - - foreach (explode("\n", $mem) as $i => $t) { - $t = explode(' ', $t); - $oid = str_replace($OID, '', $t[0]); - discover_mempool($valid_mempool, $device, $oid, 'avaya-ers', 'Unit '.($i + 1).' memory', '1', null, null); - } - } + foreach (explode("\n", $mem) as $i => $t) { + $t = explode(' ', $t); + $oid = str_replace($OID, '', $t[0]); + discover_mempool($valid_mempool, $device, $oid, 'avaya-ers', 'Unit '.($i + 1).' memory', '1', null, null); } } diff --git a/includes/discovery/processors/avaya-ers.inc.php b/includes/discovery/processors/avaya-ers.inc.php index b3692cc6ce..fd99f79414 100644 --- a/includes/discovery/processors/avaya-ers.inc.php +++ b/includes/discovery/processors/avaya-ers.inc.php @@ -1,15 +1,11 @@ $t) { - $t = explode(' ', $t); - $oid = $t[0]; - $val = $t[1]; - discover_processor($valid['processor'], $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' processor', '1', $val, $i, null); - } + $procs = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.8.1.1.6', '-Osqn'); + foreach (explode("\n", $procs) as $i => $t) { + $t = explode(' ', $t); + $oid = $t[0]; + $val = $t[1]; + discover_processor($valid['processor'], $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' processor', '1', $val, $i, null); } } diff --git a/includes/discovery/sensors/temperature/avaya-ers.inc.php b/includes/discovery/sensors/temperature/avaya-ers.inc.php index 12ea26a8c1..aef5d671da 100644 --- a/includes/discovery/sensors/temperature/avaya-ers.inc.php +++ b/includes/discovery/sensors/temperature/avaya-ers.inc.php @@ -1,21 +1,12 @@ = 5.1) { - $temps = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.7.1.1.5.5', '-Osqn'); - - foreach (explode("\n", $temps) as $i => $t) { - $t = explode(' ', $t); - $oid = $t[0]; - $val = $t[1]; - // Sensors are reported as 2 * value - $val = (trim($val) / 2); - discover_sensor($valid['sensor'], 'temperature', $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' temperature', '2', '1', null, null, null, null, $val); - } +foreach (explode("\n", $temps) as $i => $t) { + $t = explode(' ', $t); + $oid = $t[0]; + $val = $t[1]; + // Sensors are reported as 2 * value + $val = (trim($val) / 2); + discover_sensor($valid['sensor'], 'temperature', $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' temperature', '2', '1', null, null, null, null, $val); } diff --git a/includes/polling/mempools/avaya-ers.inc.php b/includes/polling/mempools/avaya-ers.inc.php index 2b87013f0b..6d70b88a08 100644 --- a/includes/polling/mempools/avaya-ers.inc.php +++ b/includes/polling/mempools/avaya-ers.inc.php @@ -1,13 +1,10 @@