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

This commit is contained in:
neg2led
2018-01-03 17:14:45 +11:00
parent 34ed39c1f9
commit a8d380f95f
2 changed files with 5 additions and 24 deletions

View File

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

View File

@@ -1,27 +1,9 @@
<?php <?php
$data = snmp_get_multi($device, 'dot11manufacturerProductName.2 dot11manufacturerProductVersion.2', '-OQUs', 'IEEE802dot11-MIB');
if (empty($data)) { if ($sysmodel = snmp_get($device, 'unifiApSystemModel.0', '-Osqnv', 'UBNT-UniFi-MIB')) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.3 dot11manufacturerProductVersion.3', '-OQUs', 'IEEE802dot11-MIB'); $hardware = $sysmodel;
} }
if (empty($data)) { if ($sysver = snmp_get($device, 'unifiApSystemVersion.0', '-Osqnv', 'UBNT-UniFi-MIB')) {
$data = snmp_get_multi($device, 'dot11manufacturerProductName.4 dot11manufacturerProductVersion.4', '-OQUs', 'IEEE802dot11-MIB'); $version = $sysver;
}
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)) {
$version = $matches[0];
}
} }