fix snmp mock issue with MAC addresses and invalid snmprec data (#12657)

This commit is contained in:
Tony Murray 2021-03-26 16:27:19 -05:00 committed by GitHub
parent 5e7c58aa1a
commit c23e273fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -50,8 +50,17 @@ function cache_snmprec($file)
} elseif ($type == '6') {
$data = trim($data, '.');
} elseif ($type == '4x') {
// MacAddress type is stored as hex string, but we don't understand mibs
if (Str::startsWith($oid, [
'1.3.6.1.2.1.2.2.1.6', // IF-MIB::ifPhysAddress
'1.3.6.1.2.1.17.1.1.0', // BRIDGE-MIB::dot1dBaseBridgeAddress.0
'1.3.6.1.4.1.890.1.5.13.13.8.1.1.20', // IES5206-MIB::slotModuleMacAddress
])) {
$data = \LibreNMS\Util\Rewrite::readableMac($data);
} else {
$data = hex2str($data);
}
}
$snmpMockCache[$file][$oid] = [$type, $data];
$line = strtok("\r\n");

View File

@ -731,5 +731,5 @@
1.3.6.1.4.1.2021.11.65.0|65|0
1.3.6.1.4.1.2021.11.66.0|65|0
1.3.6.1.4.1.2021.11.67.0|2|1
1.3.6.1.4.1.8072.1.3.2.2.1.3.6.100.101.118.105.99.101|4|\"Asus RT-N66U
1.3.6.1.4.1.8072.1.3.2.2.1.3.7.118.101.114.115.105.111.110|4|\"FreshTomato 2020.6 MIPSR2 K26AC USB AIO-64K
1.3.6.1.4.1.8072.1.3.2.2.1.3.6.100.101.118.105.99.101|4|Asus RT-N66U
1.3.6.1.4.1.8072.1.3.2.2.1.3.7.118.101.114.115.105.111.110|4|FreshTomato 2020.6 MIPSR2 K26AC USB AIO-64K

View File

@ -57,7 +57,7 @@
1.3.6.1.2.1.2.2.1.6.6|4|
1.3.6.1.2.1.2.2.1.6.7|4|
1.3.6.1.2.1.2.2.1.6.8|4x|0010A3XXYYZ1
i1.3.6.1.2.1.2.2.1.6.9|4x|0010A3XXYYZ2
1.3.6.1.2.1.2.2.1.6.9|4x|0010A3XXYYZ2
1.3.6.1.2.1.2.2.1.7.1|2|2
1.3.6.1.2.1.2.2.1.7.2|2|2
1.3.6.1.2.1.2.2.1.7.3|2|2