Module: check_mk
Branch: master
Commit: c324d5a7e8d6f28d90e8a27ffbdbd8fc427e8224
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c324d5a7e8d6f2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 11 16:17:38 2011 +0200
SNMP: better error message for invalid OIDs
---
modules/snmp.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/modules/snmp.py b/modules/snmp.py
index cd0f2b1..8c474c2 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -379,7 +379,10 @@ def get_stored_snmpwalk(hostname, oid):
if use_new:
# New implementation: use binary search
def to_bin_string(oid):
- return tuple(map(int, oid.strip(".").split(".")))
+ try:
+ return tuple(map(int, oid.strip(".").split(".")))
+ except:
+ raise MKGeneralException("Invalid OID %s" % oid)
def compare_oids(a, b):
aa = to_bin_string(a)