Module: check_mk
Branch: master
Commit: a3111cd2a4e3421eb1f5a06da16dd1521de27e21
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3111cd2a4e342…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 25 10:17:16 2013 +0100
Fixed bug introduced on last friday with multi line SNMP response
---
modules/snmp.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/snmp.py b/modules/snmp.py
index b44890d..ecf8e48 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -417,8 +417,9 @@ def snmpwalk_on_suboid(hostname, ip, oid, hex_plain = False):
# a continuation line.
rowinfo = []
try:
- for line in snmp_process.stdout.xreadlines():
- line = line.strip()
+ line_iter = snmp_process.stdout.xreadlines()
+ while True:
+ line = line_iter.next().strip()
parts = line.split('=', 1)
if len(parts) < 2:
continue # broken line, must contain =
@@ -431,7 +432,7 @@ def snmpwalk_on_suboid(hostname, ip, oid, hex_plain = False):
if len(value) > 0 and value[0] == '"' and value[-1] !=
'"': # to be continued
while True: # scan for end of this dataset
- nextline = snmp_process.next().strip()
+ nextline = line_iter.next().strip()
value += " " + nextline
if value[-1] == '"':
break