From a1999c42e265af1492dfa3ff90d0877198c8ff54 Mon Sep 17 00:00:00 2001 From: priiduonu Date: Sun, 25 Mar 2018 23:57:13 +0300 Subject: [PATCH] device: Updated moxa-etherdevice hardware/software/version detection * Update moxa-etherdevice.inc.php Would rather rely on `sysObjectID` when getting the hardware/software information as the `sysDescr` may be changed through the web interface of the device. Use numeric OID-s only. * Update moxa-etherdevice.inc.php Converted separate `snmp_get` calls into a single `snmp_get_multi_oid` call. * Update moxa-etherdevice.inc.php Unset variables at the end. * Update moxa-etherdevice.inc.php Unset multiple variables at once. * Update moxa-etherdevice.inc.php --- includes/polling/os/moxa-etherdevice.inc.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/includes/polling/os/moxa-etherdevice.inc.php b/includes/polling/os/moxa-etherdevice.inc.php index 6cba7839b8..9274894fbb 100644 --- a/includes/polling/os/moxa-etherdevice.inc.php +++ b/includes/polling/os/moxa-etherdevice.inc.php @@ -10,12 +10,16 @@ * the source code distribution for details. */ +$oids = array( + 'hardware' => $device['sysObjectID'].'.1.2.0', + 'version' => $device['sysObjectID'].'.1.4.0', + 'serial' => $device['sysObjectID'].'.1.78.0', +); + +$os_data = snmp_get_multi_oid($device, $oids); -// Moxa people enjoy creating MIBs for each model! -if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') { - $mibmod = 'MOXA-IKS6726A-MIB'; -} elseif ($device['sysDescr'] == 'EDS-G508E-T') { - $mibmod = 'MOXA-EDSG508E-MIB'; +foreach ($oids as $var => $oid) { + $$var = trim($os_data[$oid], '"'); } -$version = snmp_get($device, "firmwareVersion.0", "-OQvs", $mibmod); -$hardware = $device['sysDescr']; + +unset($oids, $os_data);