Module: check_mk
Branch: master
Commit: 8df7d5830a03d60dad6ad64b4ca37b3b3d578fe0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8df7d5830a03d6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 19 09:35:51 2017 +0200
4728 FIX Check_MK service: Fixed handling of "State in case of empty agent
output"
The Check_MK service was not respecting the state configured in the ruleset
"Status of Check_MK service" for the case where no data is provided by the
agent.
Change-Id: I09adfda60de7826e458f586e5ee3735f75b01723
---
.werks/4728 | 13 +++++++++++++
modules/check_mk_base.py | 11 ++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/.werks/4728 b/.werks/4728
new file mode 100644
index 0000000..aac3620
--- /dev/null
+++ b/.werks/4728
@@ -0,0 +1,13 @@
+Title: Check_MK service: Fixed handling of "State in case of empty agent
output"
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1495179272
+
+The Check_MK service was not respecting the state configured in the ruleset
+"Status of Check_MK service" for the case where no data is provided by the
+agent.
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 00b5861..bba4dc5 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1218,13 +1218,20 @@ def do_check(hostname, ipaddress, only_check_types = None):
save_item_state(hostname)
if problems:
output = "%s, " % problems
- status = exit_spec.get("connection", 2)
+
+ if problems == "Empty output from agent":
+ status = exit_spec.get("empty_output", 2)
+ else:
+ status = exit_spec.get("connection", 2)
+
elif num_errors > 0 and num_success > 0:
output = "Missing agent sections: %s - " % ",
".join(error_sections)
status = exit_spec.get("missing_sections", 1)
+
elif num_errors > 0:
output = "Got no information from host, "
status = exit_spec.get("empty_output", 2)
+
elif expected_version and agent_version \
and not is_expected_agent_version(agent_version, expected_version):
# expected version can either be:
@@ -1243,9 +1250,11 @@ def do_check(hostname, ipaddress, only_check_types = None):
expected = expected_version
output = "unexpected agent version %s (should be %s), " %
(agent_version, expected)
status = exit_spec.get("wrong_version", 1)
+
elif agent_min_version and agent_version < agent_min_version:
output = "old plugin version %s (should be at least %s), " %
(agent_version, agent_min_version)
status = exit_spec.get("wrong_version", 1)
+
else:
output = ""
if not is_cluster(hostname) and agent_version != None: