Module: check_mk
Branch: master
Commit: f3cd64e4cf96e249561c139ee340cc9d0f5b55c6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f3cd64e4cf96e2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 19 16:24:46 2018 +0200
6350 FIX Fixed broken checking of unrelated hosts when using manual checks
When using the Check_MK Raw Edition it could happen that configuring manual
checks for a host broke the check execution of unrelated hosts.
The configuration of the manual check of all hosts was loaded into the context
of such an unrelated host. Because a host only loads the check definitions of
the checks it needs during checking, those manual check configurations were
trying to access unavailable data. This lead to a crash and a "(null)" output
shown for the "Check_MK" service.
Change-Id: I7347801936d7e88309a09efc36756abb7f57a6ef
---
.werks/6350 | 18 ++++++++++++++++++
cmk_base/config.py | 10 +++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/.werks/6350 b/.werks/6350
new file mode 100644
index 0000000..f0c88bb
--- /dev/null
+++ b/.werks/6350
@@ -0,0 +1,18 @@
+Title: Fixed broken checking of unrelated hosts when using manual checks
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1531599198
+
+When using the Check_MK Raw Edition it could happen that configuring manual
+checks for a host broke the check execution of unrelated hosts.
+
+The configuration of the manual check of all hosts was loaded into the context
+of such an unrelated host. Because a host only loads the check definitions of
+the checks it needs during checking, those manual check configurations were
+trying to access unavailable data. This lead to a crash and a "(null)" output
+shown for the "Check_MK" service.
diff --git a/cmk_base/config.py b/cmk_base/config.py
index e63d1c5..6ebdd67 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -317,11 +317,19 @@ def add_wato_static_checks_to_checks():
else:
hostlist = entry[1]
taglist = []
+
+ # Do not process manual checks that are related to not existing or have not
+ # loaded check files
+ try:
+ check_plugin_info = check_info[checktype]
+ except KeyError:
+ continue
+
# Make sure, that for dictionary based checks
# at least those keys defined in the factory
# settings are present in the parameters
if type(params) == dict:
- def_levels_varname =
check_info[checktype].get("default_levels_variable")
+ def_levels_varname =
check_plugin_info.get("default_levels_variable")
if def_levels_varname:
for key, value in factory_settings.get(def_levels_varname,
{}).items():
if key not in params: