Pop returned value from snmpwalk_group for lldp on mikrotik routeros (#12768)

* Pop returned value from snmpwalk_group for lldp on mikrotik routeros

* Account for non-multiarray response then pull out the inner-array

* StyleCl suggested format

* Add comment

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
thegreatecheese
2021-04-20 18:14:38 +02:00
committed by GitHub
parent d5bffb28ba
commit d06be3f3f9

View File

@@ -86,6 +86,11 @@ if (($device['os'] == 'routeros')) {
echo ' LLDP-MIB: ';
$lldp_array = snmpwalk_group($device, 'lldpRemEntry', 'LLDP-MIB', 3);
if (! empty($lldp_array)) {
// workaround for routeros returning the incorrect index
if (! empty($lldp_array[0][0])) {
$lldp_array = $lldp_array[0][0];
}
$lldp_ports = snmpwalk_group($device, 'mtxrInterfaceStatsName', 'MIKROTIK-MIB');
$lldp_ports_num = snmpwalk_group($device, 'mtxrNeighborInterfaceID', 'MIKROTIK-MIB');