Fixed UniFi AP hardware type and firmware version retrieval (#8005)

* Fixed UniFi AP hardware type and firmware version retrieval, enabled snmpbulkwalk

* Modified to pull from appropriate OID depending on sysObjectID

* Revert "Modified to pull from appropriate OID depending on sysObjectID" - typos in snmp_get_multi() commands

This reverts commit 5c2b6039f4.

* Revert "Revert "Modified to pull from appropriate OID depending on sysObjectID" - typos in snmp_get_multi() commands"

This reverts commit bccf301a8b, so I can submit everything in the one commit

* Revert "Modified to pull from appropriate OID depending on sysObjectID"

This reverts commit 5c2b6039f4 due to errors in code

* Revert to commit a8d380f and then apply changes to account for both old and new agent responses.

* Pull IEEE802dot11-MIB values via snmp_getnext() & sanity check returned results

* Fixed typo in previous commit - [0]s where they don't belong.

* Updated to take advantage of new snmp_getnext_multi() function

* Updated to account for changes to snmp_getnext_multi in pr#8052
This commit is contained in:
Andrew Holmes
2018-01-09 16:48:04 +11:00
committed by Tony Murray
parent 81fbe95039
commit e3720235f4
2 changed files with 6 additions and 24 deletions

View File

@@ -2,7 +2,6 @@ os: unifi
text: 'Ubiquiti UniFi'
type: wireless
icon: ubiquiti
nobulk: 1
group: ubnt
over:
- { graph: device_bits, text: 'Device Traffic' }

View File

@@ -1,27 +1,10 @@
<?php
$data = snmp_get_multi($device, 'dot11manufacturerProductName.2 dot11manufacturerProductVersion.2', '-OQUs', 'IEEE802dot11-MIB');
if (empty($data)) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.3 dot11manufacturerProductVersion.3', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.4 dot11manufacturerProductVersion.4', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.5 dot11manufacturerProductVersion.5', '-OQUs', 'IEEE802dot11-MIB');
}
if (empty($data)) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.6 dot11manufacturerProductVersion.6', '-OQUs', 'IEEE802dot11-MIB');
}
foreach ($data as $line) {
if (!empty($line['dot11manufacturerProductName'])) {
$hardware = $line['dot11manufacturerProductName'];
}
if (preg_match('/(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $line['dot11manufacturerProductVersion'], $matches)) {
if ($data = snmp_get_multi($device, 'unifiApSystemModel unifiApSystemVersion', '-OQUs', 'UBNT-UniFi-MIB')) {
$hardware = $data['unifiApSystemModel'];
$version = $data['unifiApSystemVersion'];
} elseif ($data = snmp_getnext_multi($device, 'dot11manufacturerProductName dot11manufacturerProductVersion', '-OQUs', 'IEEE802dot11-MIB')) {
$hardware = $data['dot11manufacturerProductName'];
if (preg_match('/(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data['dot11manufacturerProductVersion'], $matches)) {
$version = $matches[0];
}
}