Module: check_mk
Branch: master
Commit: 1804d5f6966eaa929cac02c32bbe6037a7d2bd2a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1804d5f6966eaa…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Dec 12 09:49:41 2017 +0100
5252 FIX Agent Updater Check: increased robustness in handling incomplete agent data
Change-Id: I7f51b3a33e0e88032c6890f2bce49177fb7d64a3
---
.werks/5252 | 10 ++++++++++
checks/check_mk | 7 +++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/.werks/5252 b/.werks/5252
new file mode 100644
index 0000000..2c4a922
--- /dev/null
+++ b/.werks/5252
@@ -0,0 +1,10 @@
+Title: Agent Updater Check: increased robustness in handling incomplete agent data
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cee
+Version: 1.5.0i2
+Date: 1513068500
+Class: fix
+
+
diff --git a/checks/check_mk b/checks/check_mk
index ed7d90b..efcbabe 100644
--- a/checks/check_mk
+++ b/checks/check_mk
@@ -148,9 +148,12 @@ def check_cmk_agent_update(_no_item, _no_params, info):
if parsed["error"] != "None":
yield 1, "error: %s" % parsed["error"]
+ if len(parsed.keys()) == 1:
+ return
else:
yield 0, "no errors"
+
try:
last_check = float(parsed["last_check"])
age = now - last_check
@@ -168,10 +171,10 @@ def check_cmk_agent_update(_no_item, _no_params, info):
except:
yield 1, "no successful connect to server yet"
- if parsed["last_update"]:
+ if "last_update" in parsed:
yield 0, "last agent update: %s" %
get_timestamp_human_readable(parsed["last_update"])
- if parsed["aghash"]:
+ if "aghash" in parsed:
yield 0, "agent configuration: %s" %
parsed["aghash"][:8]
return