Module: check_mk
Branch: master
Commit: 8a3d5e21f95b022cb064c1d5fb46ebe086555820
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a3d5e21f95b02…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 17 08:40:08 2018 +0200
6098 FIX Raw Edition: Fixed broken "Check_MK" service when monitoring host named
"cmk"
In case a host named "cmk" is being monitored, the "Check_MK" services
of all hosts
terminate with an output of "(null)". When executing a precompiled host check
file (var/check_mk/precompiled/[host]) manually
it terminates with an error message like this:
Traceback (most recent call last):
File "/omd/sites/beta/var/check_mk/precompiled/beta", line 7, in
<module>
Change-Id: Ic276c5fc6709ec97cac916aefaf01a1322bff6d5
ImportError: No module named cmk.log
---
.werks/6098 | 18 ++++++++++++++++++
cmk_base/core_nagios.py | 11 ++++++-----
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/.werks/6098 b/.werks/6098
new file mode 100644
index 0000000..18ee716
--- /dev/null
+++ b/.werks/6098
@@ -0,0 +1,18 @@
+Title: Raw Edition: Fixed broken "Check_MK" service when monitoring host named
"cmk"
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526539081
+
+In case a host named "cmk" is being monitored, the "Check_MK"
services of all hosts
+terminate with an output of "(null)". When executing a precompiled host check
file (var/check_mk/precompiled/[host]) manually
+it terminates with an error message like this:
+
+Traceback (most recent call last):
+ File "/omd/sites/beta/var/check_mk/precompiled/beta", line 7, in
<module>
+
+ImportError: No module named cmk.log
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index e33c461..d4ef18b 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -962,6 +962,12 @@ def _precompile_hostcheck(hostname):
output.write("# encoding: utf-8\n\n")
output.write("import sys\n")
+
+ # Remove precompiled directory from sys.path. Leaving it in the path
+ # makes problems when host names (name of precompiled files) are equal
+ # to python module names like "random"
+ output.write("sys.path.pop(0)\n")
+
output.write("import cmk.log\n")
output.write("import cmk.debug\n")
output.write("from cmk.exceptions import MKTerminate\n")
@@ -986,11 +992,6 @@ if os.path.islink(%(dst)r):
""" % { "src" : source_filename, "dst" :
compiled_filename })
- # Remove precompiled directory from sys.path. Leaving it in the path
- # makes problems when host names (name of precompiled files) are equal
- # to python module names like "random"
- output.write("sys.path.pop(0)\n")
-
# Register default Check_MK signal handler
output.write("cmk_base.utils.register_sigint_handler()\n")