mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
ignore Wrong Type errors in snpm_get and snmp_get_multi_oid (#12800)
Works around some awfully broken devices.
This commit is contained in:
@@ -228,8 +228,8 @@ function snmp_get_multi_oid($device, $oids, $options = '-OUQn', $mib = null, $mi
|
||||
|
||||
$data = [];
|
||||
foreach (array_chunk($oids, $oid_limit) as $chunk) {
|
||||
$cmd = gen_snmpget_cmd($device, $chunk, $options, $mib, $mibdir);
|
||||
$result = trim(external_exec($cmd));
|
||||
$output = external_exec(gen_snmpget_cmd($device, $chunk, $options, $mib, $mibdir));
|
||||
$result = trim(str_replace('Wrong Type (should be OBJECT IDENTIFIER): ', '', $output));
|
||||
if ($result) {
|
||||
$data = array_merge($data, explode("\n", $result));
|
||||
}
|
||||
@@ -278,8 +278,9 @@ function snmp_get($device, $oid, $options = null, $mib = null, $mibdir = null)
|
||||
throw new Exception("snmp_get called for multiple OIDs: $oid");
|
||||
}
|
||||
|
||||
$cmd = gen_snmpget_cmd($device, $oid, $options, $mib, $mibdir);
|
||||
$data = trim(external_exec($cmd), "\\\" \n\r");
|
||||
$output = external_exec(gen_snmpget_cmd($device, $oid, $options, $mib, $mibdir));
|
||||
$output = str_replace('Wrong Type (should be OBJECT IDENTIFIER): ', '', $output);
|
||||
$data = trim($output, "\\\" \n\r");
|
||||
|
||||
recordSnmpStatistic('snmpget', $time_start);
|
||||
if (preg_match('/(No Such Instance|No Such Object|No more variables left|Authentication failure)/i', $data)) {
|
||||
|
Reference in New Issue
Block a user