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
This commit is contained in:
priiduonu
2018-03-25 23:57:13 +03:00
committed by Neil Lathwood
parent 9f5b42b028
commit a1999c42e2

View File

@@ -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);