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
This commit is contained in:
Tom Sealey
2017-07-29 11:20:36 +01:00
committed by Neil Lathwood
parent de6af21131
commit f8b795ec95
4 changed files with 26 additions and 53 deletions

View File

@@ -3,24 +3,13 @@
$OID = '.1.3.6.1.4.1.45.1.6.3.8.1.1.12'; $OID = '.1.3.6.1.4.1.45.1.6.3.8.1.1.12';
if ($device['os'] == 'avaya-ers') { if ($device['os'] == 'avaya-ers') {
// Memory information only known to work with 5500 and 5600 switches $mem = snmp_walk($device, $OID, '-Osqn');
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];
// Temperature info only known to be present in firmware 6.1 or higher echo "$mem\n";
if ($fw_major_version >= 6.1) {
$mem = snmp_walk($device, $OID, '-Osqn');
echo "$mem\n"; foreach (explode("\n", $mem) as $i => $t) {
$t = explode(' ', $t);
foreach (explode("\n", $mem) as $i => $t) { $oid = str_replace($OID, '', $t[0]);
$t = explode(' ', $t); discover_mempool($valid_mempool, $device, $oid, 'avaya-ers', 'Unit '.($i + 1).' memory', '1', null, null);
$oid = str_replace($OID, '', $t[0]);
discover_mempool($valid_mempool, $device, $oid, 'avaya-ers', 'Unit '.($i + 1).' memory', '1', null, null);
}
}
} }
} }

View File

@@ -1,15 +1,11 @@
<?php <?php
if ($device['os'] == 'avaya-ers') { if ($device['os'] == 'avaya-ers') {
// Processor information only know to work with 3500, 5500 and 5600 switches $procs = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.8.1.1.6', '-Osqn');
if (preg_match('/[35][56][0-9][0-9]/', $device['sysDescr'])) { foreach (explode("\n", $procs) as $i => $t) {
$procs = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.8.1.1.6', '-Osqn'); $t = explode(' ', $t);
$oid = $t[0];
foreach (explode("\n", $procs) as $i => $t) { $val = $t[1];
$t = explode(' ', $t); discover_processor($valid['processor'], $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' processor', '1', $val, $i, null);
$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);
}
} }
} }

View File

@@ -1,21 +1,12 @@
<?php <?php
// Get major version number of running firmware $temps = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.7.1.1.5.5', '-Osqn');
$fw_major_version = null;
preg_match('/[0-9]\.[0-9]/', $device['version'], $fw_major_version);
$fw_major_version = $fw_major_version[0];
// Temperature info only known to be present in firmware 6.1 or higher foreach (explode("\n", $temps) as $i => $t) {
// Except on ERS 3500 switches, known to exist on firmware 5.1 or higher $t = explode(' ', $t);
if ($fw_major_version >= 5.1) { $oid = $t[0];
$temps = snmp_walk($device, '.1.3.6.1.4.1.45.1.6.3.7.1.1.5.5', '-Osqn'); $val = $t[1];
// Sensors are reported as 2 * value
foreach (explode("\n", $temps) as $i => $t) { $val = (trim($val) / 2);
$t = explode(' ', $t); discover_sensor($valid['sensor'], 'temperature', $device, $oid, zeropad($i + 1), 'avaya-ers', 'Unit '.($i + 1).' temperature', '2', '1', null, null, null, null, $val);
$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);
}
} }

View File

@@ -1,13 +1,10 @@
<?php <?php
// Memory information only known to work with 5500 and 5600 switches $index = $mempool['mempool_index'];
if (preg_match('/5[56][0-9][0-9]/', $device['sysDescr'])) {
$index = $mempool['mempool_index'];
$total = (snmp_get($device, ".1.3.6.1.4.1.45.1.6.3.8.1.1.12$index", '-Oqv') * 1048576); $total = (snmp_get($device, ".1.3.6.1.4.1.45.1.6.3.8.1.1.12$index", '-Oqv') * 1048576);
$avail = (snmp_get($device, ".1.3.6.1.4.1.45.1.6.3.8.1.1.13$index", '-Oqv') * 1048576); $avail = (snmp_get($device, ".1.3.6.1.4.1.45.1.6.3.8.1.1.13$index", '-Oqv') * 1048576);
$mempool['total'] = $total; $mempool['total'] = $total;
$mempool['free'] = $avail; $mempool['free'] = $avail;
$mempool['used'] = ($total - $avail); $mempool['used'] = ($total - $avail);
}