Module: check_mk
Branch: master
Commit: 19b152a19b457349e74ff4f9b8ed98e43e3aeb19
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=19b152a19b4573…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 2 13:01:34 2011 +0100
Fixed status ouput of Check_MK in cluster setup
---
ChangeLog | 1 +
modules/check_mk_base.py | 10 ++++++----
modules/snmp.py | 4 ++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b75f5e1..4a6b5ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Core, Setup, etc.:
* Fix crash on Python 2.4 (e.g. RedHat) with fake_file
* Fixed clustering of SNMP hosts
+ * Fix status output of Check_MK check in mixed cluster setups
1.1.9i6:
INCOMPATIBLE CHANGES:
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index f316ef5..78ab047 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -268,10 +268,12 @@ def get_host_info(hostname, ipaddress, checkname):
info += get_realhost_info(node, ipaddress, checkname,
cluster_max_cachefile_age)
at_least_one_without_exception = True
except MKAgentError, e:
- exception_texts.append(str(e))
+ if str(e) != "": # only first error contains text
+ exception_texts.append(str(e))
g_broken_agent_hosts.add(node)
except MKSNMPError, e:
- exception_texts.append(str(e))
+ if str(e) != "": # only first error contains text
+ exception_texts.append(str(e))
g_broken_snmp_hosts.add(node)
is_snmp_error = True
if not at_least_one_without_exception:
@@ -703,7 +705,7 @@ def do_check(hostname, ipaddress):
output = "WARNING - old plugin version %s (should be at least %s)"
% (agent_version, agent_min_version)
status = 1
else:
- output = "OK - Agent Version %s, processed %d host infos" %
(agent_version, num_success)
+ output = "OK - Agent version %s" % (agent_version, num_success)
status = 0
except MKGeneralException, e:
@@ -720,7 +722,7 @@ def do_check(hostname, ipaddress):
raise
run_time = time.time() - start_time
- output += " in %.1f sec|execution_time=%.3f\n" % (run_time, run_time)
+ output += ", execution time %.1f sec|execution_time=%.3f\n" % (run_time,
run_time)
sys.stdout.write(output)
sys.exit(status)
diff --git a/modules/snmp.py b/modules/snmp.py
index 8229b23..5ed920d 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -108,7 +108,7 @@ def get_snmp_explicit(hostname, ipaddress, mib, baseoid, suffixes):
if exitstatus:
if opt_verbose:
sys.stderr.write(tty_red + tty_bold + "ERROR: " + tty_normal +
"SNMP error\n")
- raise MKSNMPError("SNMP Error")
+ raise MKSNMPError("SNMP Error on %s" % ipaddress)
return info
def snmpwalk_on_suboid(hostname, ip, oid):
@@ -153,7 +153,7 @@ def snmpwalk_on_suboid(hostname, ip, oid):
if exitstatus:
if opt_verbose:
sys.stderr.write(tty_red + tty_bold + "ERROR: " + tty_normal +
"SNMP error\n")
- raise MKSNMPError("SNMP Error")
+ raise MKSNMPError("SNMP Error on %s" % ip)
return rowinfo
def get_snmp_table(hostname, ip, oid_info):