Module: check_mk
Branch: master
Commit: 53942579195e0eca5aff72a25e888ac85ee1076a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=53942579195e0e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 17 15:26:15 2014 +0100
#1513 FIX Handle broken SNMP bulk walk implementation of Mikrotik Router firmware RouterOS
v6.22
This firmware sometimes responds with duplicate OIDs on a bulk walk. This has
been fixed by ignoring consecutive answers for the same OID.
---
.werks/1513 | 11 +++++++++++
ChangeLog | 1 +
modules/snmp.py | 10 +++++++++-
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/1513 b/.werks/1513
new file mode 100644
index 0000000..fe089cb
--- /dev/null
+++ b/.werks/1513
@@ -0,0 +1,11 @@
+Title: Handle broken SNMP bulk walk implementation of Mikrotik Router firmware RouterOS
v6.22
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1416234308
+Class: fix
+
+This firmware sometimes responds with duplicate OIDs on a bulk walk. This has
+been fixed by ignoring consecutive answers for the same OID.
+
diff --git a/ChangeLog b/ChangeLog
index 2eb70db..a1d651a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,7 @@
NOTE: Please refer to the migration notes!
* 1437 FIX: veeam_jobs: fixed incorrect state for BackupSync job...
* 1511 FIX: oracle_jobs: avoid broken checks, make compatible with old version...
+ * 1513 FIX: Handle broken SNMP bulk walk implementation of Mikrotik Router firmware
RouterOS v6.22...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/modules/snmp.py b/modules/snmp.py
index c45ff46..159e2a4 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -133,7 +133,6 @@ def get_snmp_table(hostname, ip, check_type, oid_info):
index_format = column
continue
-
if opt_use_snmp_walk or is_usewalk_host(hostname):
rowinfo = get_stored_snmpwalk(hostname, fetchoid)
elif has_inline_snmp and use_inline_snmp:
@@ -141,6 +140,15 @@ def get_snmp_table(hostname, ip, check_type, oid_info):
else:
rowinfo = snmpwalk_on_suboid(hostname, ip, fetchoid)
+ # I've seen a broken device (Mikrotik Router), that broke after an
+ # update to RouterOS v6.22. It would return 9 time the same OID when
+ # .1.3.6.1.2.1.1.1.0 was being walked. We try to detect these situations
+ # by removing any duplicate OID information
+ if len(rowinfo) > 1 and rowinfo[0][0] == rowinfo[1][0]:
+ if opt_verbose:
+ sys.stderr.write("Detected broken SNMP agent. Ignoring duplicate
OID %s.\n" % rowinfo[0][0])
+ rowinfo = rowinfo[:1]
+
columns.append((fetchoid, rowinfo))
number_rows = len(rowinfo)
if len(rowinfo) > max_len: