Module: check_mk
Branch: master
Commit: 6707ea3c5d8ab5530910d9d3fc1a2ae92c42b23f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6707ea3c5d8ab5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 10 14:19:43 2011 +0100
FIX: fix handling of empty suboids
---
ChangeLog | 3 +++
modules/snmp.py | 10 +++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fd456ae..5c35025 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,9 @@
* extra_buttons can now register a function to gather the URL to link to
1.1.12p2:
+ Core, Setup, etc.:
+ * FIX: fix handling of empty suboids
+
Checks & Agents:
* FIX: mem.win: Default levels now works, check not always OK
* FIX: blade_health: fix OID specification
diff --git a/modules/snmp.py b/modules/snmp.py
index 211a164..0bcee8c 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -121,10 +121,14 @@ def extract_end_oid(prefix, complete):
return complete[len(prefix):].lstrip('.')
# sort OID strings numerically
+def oid_to_intlist(oid):
+ if oid:
+ return map(int, oid.split('.'))
+ else:
+ return []
+
def cmp_oids(o1, o2):
- i1 = map(int, o1.split('.'))
- i2 = map(int, o2.split('.'))
- return cmp(i1, i2)
+ return cmp(oid_to_intlist(o1), oid_to_intlist(o2))
def get_snmp_table(hostname, ip, oid_info):
# oid_info is either ( oid, columns ) or