Module: check_mk
Branch: master
Commit: 5127c1378959779bf70de24d7745c2e6177621ef
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5127c137895977…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 23 17:06:51 2015 +0100
#1919 FIX cmk --snmpwalk: continue if one of the OIDs to walk fails
---
.werks/1919 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk.py | 25 +++++++++++--------------
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/.werks/1919 b/.werks/1919
new file mode 100644
index 0000000..25e9a66
--- /dev/null
+++ b/.werks/1919
@@ -0,0 +1,10 @@
+Title: cmk --snmpwalk: continue if one of the OIDs to walk fails
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1422029191
+
+
diff --git a/ChangeLog b/ChangeLog
index 0f8fa5f..ff04e32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
* 1808 FIX: Fixed broken nagios config when using RBN without a host defined...
* 1842 FIX: Rewrote implementation of service discovery (formerly inventory)...
* 1869 FIX: Deleting outdated persisted agent sections now
+ * 1919 FIX: cmk --snmpwalk: continue if one of the OIDs to walk fails
Checks & Agents:
* 1665 agent_netapp: New special agent for NetApp monitoring via Web-API...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 89a23ac..d3b5aed 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3895,8 +3895,7 @@ def do_snmpwalk(hostnames):
raise
def do_snmpwalk_on(hostname, filename):
- if opt_verbose:
- sys.stdout.write("%s:\n" % hostname)
+ verbose("%s:\n" % hostname)
ip = lookup_ipaddress(hostname)
out = file(filename, "w")
@@ -3908,21 +3907,19 @@ def do_snmpwalk_on(hostname, filename):
] + opt_extra_oids
for oid in oids_to_walk:
- if opt_verbose:
- sys.stdout.write("Walk on \"%s\"..." % oid)
- sys.stdout.flush()
-
- results = snmpwalk_on_suboid(hostname, ip, oid, hex_plain = True)
-
- for oid, value in results:
- out.write("%s %s\n" % (oid, value))
+ try:
+ verbose("Walk on \"%s\"..." % oid)
- if opt_verbose:
- sys.stdout.write("%d variables.\n" % len(results))
+ results = snmpwalk_on_suboid(hostname, ip, oid, hex_plain = True)
+ for oid, value in results:
+ out.write("%s %s\n" % (oid, value))
+ verbose("%d variables.\n" % len(results))
+ except:
+ if opt_debug:
+ raise
out.close()
- if opt_verbose:
- sys.stdout.write("Successfully Wrote %s%s%s.\n" % (tty_bold, filename,
tty_normal))
+ verbose("Successfully Wrote %s%s%s.\n" % (tty_bold, filename, tty_normal))
def do_snmpget(oid, hostnames):
if len(hostnames) == 0: