Module: check_mk
Branch: master
Commit: 99cbf67c5dfbc8635ccde705da8de87f84630073
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99cbf67c5dfbc8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jun 30 12:27:21 2011 +0200
FIX: Fixed OID_END handling in SNMP based checks (e.g. canon_pages)
---
ChangeLog | 1 +
modules/snmp.py | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 010e3eb..9af8c04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Core, Setup, etc.:
* FIX: sort output of cmk --list-hosts alphabetically
* FIX: Fixed .* in SNMP scan function when using stored SNMP walks
+ * FIX: Fixed OID_END handling in SNMP based checks (e.g. canon_pages)
Checks & Agents:
* FIX: apc_symmetra: fix remaining runtime calculation (by factor 100)
diff --git a/modules/snmp.py b/modules/snmp.py
index 3fa670f..0ccff3e 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -157,7 +157,10 @@ def snmpwalk_on_suboid(hostname, ip, oid):
return rowinfo
def extract_end_oid(prefix, complete):
- return complete[len(prefix):].lstrip('.')
+ if prefix == complete:
+ return complete.split('.')[-1]
+ else:
+ return complete[len(prefix):].lstrip('.')
# sort OID strings numerically
def cmp_oids(o1, o2):
@@ -428,7 +431,8 @@ def get_stored_snmpwalk(hostname, oid):
value = agent_simulator_process(value)
else:
value = ""
- rows.append((o, strip_snmp_value(value)))
+ # Fix for missing starting oids
+ rows.append(('.'+o, strip_snmp_value(value)))
index += direction
if index < 0 or index >= len(lines):
break