Module: check_mk
Branch: master
Commit: 19cf81db3c42f0b910ccca2f80dcacabd049598e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=19cf81db3c42f0…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Fri Feb 15 17:21:18 2019 +0100
6758 FIX mknotifyd: Fixed crash if the mknotify check sends no data
The check previously crashed, if the agent sends a site name but no data for
this site. If there is no data, this will be displayed now in the service
output. Additionally the service will change it's state to WARN because
there is no data for the last update time of mknotify state file.
Change-Id: Icfab565fb1bcf45218d85413e0470f4df845f899
---
.werks/6758 | 13 +++++++++++++
checks/mknotifyd | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/.werks/6758 b/.werks/6758
new file mode 100644
index 0000000..11973f8
--- /dev/null
+++ b/.werks/6758
@@ -0,0 +1,13 @@
+Title: mknotifyd: Fixed crash if the mknotify check sends no data
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1550247640
+Class: fix
+
+The check previously crashed, if the agent sends a site name but no data for
+this site. If there is no data, this will be displayed now in the service
+output. Additionally the service will change it's state to WARN because
+there is no data for the last update time of mknotify state file.
diff --git a/checks/mknotifyd b/checks/mknotifyd
index 7863936..d3ae439 100644
--- a/checks/mknotifyd
+++ b/checks/mknotifyd
@@ -148,6 +148,12 @@ def check_mknotifyd(item, _no_params, parsed):
if item not in parsed:
yield 2, "No status information, Spooler not running"
return
+ # There are dummy-entries created during the parsing. So the
+ # dict will never be completely empty. We check for Version
+ # because this should be always present in a valid state file.
+ elif not parsed[item].get("Version"):
+ yield 2, "The state file seems to be empty. It is very likely that the
spooler is not working properly"
+ return
now = time.time()
stat = parsed[item]