Module: check_mk
Branch: master
Commit: db79bf97e2fb8e14cf6adc8cc667dbcb5c15ea86
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db79bf97e2fb8e…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Jan 15 17:18:27 2016 +0100
fixed wrong result when retrieving single oids from snmp walks in very rare cases
for this bug to occur, the following things had to be true
a) working with a snmp walk
b) the requested single oid does not exist in the walk itself ...
c) ... but has a single sub-oid
In this case the value of the sub-oid was returned instead of nothing
---
modules/check_mk.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index e8c1ad4..74361b0 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1611,7 +1611,9 @@ def get_single_oid(hostname, ipaddress, oid):
vverbose(" Getting OID %s: " % oid)
if opt_use_snmp_walk or is_usewalk_host(hostname):
walk = get_stored_snmpwalk(hostname, oid)
- if len(walk) == 1:
+ # get_stored_snmpwalk returns all oids that start with oid but here
+ # we need an exact match
+ if len(walk) == 1 and oid == walk[0][0]:
value = walk[0][1]
else:
value = None