Module: check_mk
Branch: master
Commit: a3cbded2c40df3ad37efc15424fa0387ebee5cee
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3cbded2c40df3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 17 10:31:39 2018 +0200
Revert "6063 FIX Special agents: Remove unreplaced macros from special agent command lines"
This reverts commit 4b558182d2c0d2cf077fb039cddf78243030b7c2.
---
.werks/6063 | 20 --------------------
cmk_base/data_sources/programs.py | 8 --------
tests/unit/cmk_base/test_data_sources_unit.py | 20 --------------------
3 files changed, 48 deletions(-)
diff --git a/.werks/6063 b/.werks/6063
deleted file mode 100644
index 8187cb5..0000000
--- a/.werks/6063
+++ /dev/null
@@ -1,20 +0,0 @@
-Title: Special agents: Remove unreplaced macros from special agent command lines
-Level: 1
-Component: core
-Class: fix
-Compatible: compat
-Edition: cre
-State: unknown
-Version: 1.6.0i1
-Date: 1525865298
-
-In previous versions the command lines of special agent calls like e.g. custom
-data source programs could contain unreplaced macros in the format <tt>$_HOST_MACRO$</tt>
-which were later inpterpreted as shell variables. In case there was no such variable in
-the shell environment, the trailing <tt>$</tt> was left on the command line as single
-character.
-
-This could lead to some broken command line calls. We now do the replacement as usual.
-After replacing all known macros, the command line is searched for left over $...$ macros
-and remove the whole macro from the command line. This should make optional macro handling
-a lot easier.
diff --git a/cmk_base/data_sources/programs.py b/cmk_base/data_sources/programs.py
index 8dd4f1f..e3f49e4 100644
--- a/cmk_base/data_sources/programs.py
+++ b/cmk_base/data_sources/programs.py
@@ -29,7 +29,6 @@ import signal
import subprocess
import cmk.paths
-import cmk.regex
import cmk_base.console as console
import cmk_base.config as config
@@ -137,7 +136,6 @@ class DSProgramDataSource(ProgramDataSource):
cmd = self._translate_legacy_macros(cmd)
cmd = self._translate_host_macros(cmd)
- cmd = self._cleanup_left_over_macros(cmd)
return cmd
@@ -159,12 +157,6 @@ class DSProgramDataSource(ProgramDataSource):
return core_config.replace_macros(cmd, macros)
- def _cleanup_left_over_macros(self, cmd):
- """Now after we have replaced all known macros remove all remaining macros in
- the format $...$ to prevent shell expansion of them"""
- return cmk.regex.regex(r"\$[a-zA-Z0-9_-]+\$").sub("", cmd)
-
-
class SpecialAgentDataSource(ProgramDataSource):
def __init__(self, hostname, ipaddress, special_agent_id, params):
diff --git a/tests/unit/cmk_base/test_data_sources_unit.py b/tests/unit/cmk_base/test_data_sources_unit.py
index 10de607..65503ef 100644
--- a/tests/unit/cmk_base/test_data_sources_unit.py
+++ b/tests/unit/cmk_base/test_data_sources_unit.py
@@ -34,23 +34,3 @@ def test_disable_data_source_cache_no_write(mocker):
disabled_checker = mocker.patch.object(source, "is_agent_cache_disabled")
assert source._write_cache_file("X") is None
disabled_checker.assert_called_once()
-
-
-def test_ds_command_line_expansion_legacy_macros():
- source = cmk_base.data_sources.programs.DSProgramDataSource("hostname", "ipaddress", "echo '<IP> <HOST>'")
- assert source._get_command_line() == "echo 'ipaddress hostname'"
-
-
-def test_ds_command_line_expansion_host_macros():
- source = cmk_base.data_sources.programs.DSProgramDataSource("hostname", "ipaddress", "echo '$HOSTNAME$'")
- assert source._get_command_line() == "echo 'hostname'"
-
-
-def test_ds_command_line_expansion_left_over_macros():
- source = cmk_base.data_sources.programs.DSProgramDataSource("hostname", "ipaddress", "echo '$BLABLUB$'")
- assert source._get_command_line() == "echo ''"
-
-
-def test_ds_command_line_expansion_skip_shell_variables():
- source = cmk_base.data_sources.programs.DSProgramDataSource("hostname", "ipaddress", "echo '$BLABLUB$ $XXX'")
- assert source._get_command_line() == "echo ' $XXX'"
Module: check_mk
Branch: master
Commit: 4469d97f0f474eda14e67ab7aeadb3a5dbdfceff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4469d97f0f474e…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu May 17 09:57:50 2018 +0200
EC: handle_absent_event -> _handle_absent_event
Change-Id: Ifc5879a02b9d1650b3045ec1c012b5dac8e1f24c
---
cmk/ec/main.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 37e1a71..1ca1f27 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -1228,7 +1228,7 @@ class EventServer(ECServerThread):
# time has elapsed. Now lets see if we have reached
# the neccessary count:
if event["count"] < expected_count: # no -> trigger alarm
- self.handle_absent_event(rule, event["count"], expected_count, event["last"])
+ self._handle_absent_event(rule, event["count"], expected_count, event["last"])
else: # yes -> everything is fine. Just log.
self._logger.info("Rule %s/%s has reached %d occurrances (%d required). "
"Starting next period." %
@@ -1240,12 +1240,12 @@ class EventServer(ECServerThread):
# Ou ou, no event found at all.
else:
- self.handle_absent_event(rule, 0, expected_count, interval_start)
+ self._handle_absent_event(rule, 0, expected_count, interval_start)
for nr in events_to_delete[::-1]:
self._event_status.remove_event(events[nr])
- def handle_absent_event(self, rule, event_count, expected_count, interval_start):
+ def _handle_absent_event(self, rule, event_count, expected_count, interval_start):
now = time.time()
if event_count:
text = "Expected message arrived only %d out of %d times since %s" % \
@@ -2601,7 +2601,7 @@ class QueryCOMMAND(Query):
# an event is being created:
# * create_event_from_trap()
# * create_event_from_line()
-# * handle_absent_event()
+# * _handle_absent_event()
# * _create_overflow_event()
# - When loading the status file add the possibly missing column to all
# loaded events (load_status())
Module: check_mk
Branch: master
Commit: a73f13ec9ffa7afd7aaf636cbe628c8e912caaf2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a73f13ec9ffa7a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 17 09:18:22 2018 +0200
6099 FIX Only reset default version when current default version is uninstalled
Previously all RPM packages that were uninstalled were resetting the current
default version to the result of "ls -A /omd/versions 2>/dev/null| sort -n |
tail -n 1". The uninstall logic of NEW packages will now first check whether or
not the version currently being removed is the default version and only reset
the default version in case it is needed.
Change-Id: Iee25acb6bc6352256a60ffa10f9c8654a9956c2d
---
.werks/6099 | 14 ++++++++++++++
omd/omd.spec.in | 12 +++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.werks/6099 b/.werks/6099
new file mode 100644
index 0000000..6f09c2e
--- /dev/null
+++ b/.werks/6099
@@ -0,0 +1,14 @@
+Title: Only reset default version when current default version is uninstalled
+Level: 1
+Component: rpm
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1526541350
+Class: fix
+
+Previously all RPM packages that were uninstalled were resetting the current
+default version to the result of "ls -A /omd/versions 2>/dev/null| sort -n |
+tail -n 1". The uninstall logic of NEW packages will now first check whether or
+not the version currently being removed is the default version and only reset
+the default version in case it is needed.
diff --git a/omd/omd.spec.in b/omd/omd.spec.in
index 23631f7..a746cd0 100644
--- a/omd/omd.spec.in
+++ b/omd/omd.spec.in
@@ -176,13 +176,19 @@ fi
%postun
-rm -f /omd/versions/default
v=$(ls -A /omd/versions 2>/dev/null| sort -n | tail -n 1)
if [ -n "$v" ]
then
- echo "New default version is $v"
- ln -sfn "$v" /omd/versions/default
+ DEFAULT_VERSION=$(readlink /omd/versions/default 2>/dev/null)
+ DEFAULT_VERSION=${DEFAULT_VERSION##*/}}
+ if [ "$v" = "$DEFAULT_VERSION" ]; then
+ echo "New default version is $v"
+ ln -sfn "$v" /omd/versions/default
+ else
+ echo "Leaving default version $DEFAULT_VERSION"
+ fi
else
+ rm -f /omd/versions/default
echo "Removing system group 'omd'"
groupdel omd
echo "Removing global symbolic links"
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")
Module: check_mk
Branch: master
Commit: 5b02b7724e693098c3e2734198ef1bd1bb257f38
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5b02b7724e6930…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 17 08:32:35 2018 +0200
6097 FIX Raw Edition: Fix possible "(null)" output of Check_MK services
The Check_MK service of multiple hosts may terminate without proper error
message resulting just in status output "(null)" in specific situations.
This happened when the precompiled host check files
(var/check_mk/precompiled/[host]) were executed by Nagios using the system wide
Python interpreter instead of the site specific interpreter.
Change-Id: I420d6c0b67e2c52fc3b226cb74c136da5004bd95
---
.werks/6097 | 16 ++++++++++++++++
cmk_base/core_nagios.py | 2 +-
.../skel/etc/nagios/conf.d/check_mk_templates.cfg | 2 +-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.werks/6097 b/.werks/6097
new file mode 100644
index 0000000..0f2352f
--- /dev/null
+++ b/.werks/6097
@@ -0,0 +1,16 @@
+Title: Raw Edition: Fix possible "(null)" output of Check_MK services
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526538591
+
+The Check_MK service of multiple hosts may terminate without proper error
+message resulting just in status output "(null)" in specific situations.
+
+This happened when the precompiled host check files
+(var/check_mk/precompiled/[host]) were executed by Nagios using the system wide
+Python interpreter instead of the site specific interpreter.
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index 9cfd5fe..e33c461 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -958,7 +958,7 @@ def _precompile_hostcheck(hostname):
return
output = file(source_filename + ".new", "w")
- output.write("#!/usr/bin/python\n")
+ output.write("#!/usr/bin/env python\n")
output.write("# encoding: utf-8\n\n")
output.write("import sys\n")
diff --git a/omd/packages/check_mk/skel/etc/nagios/conf.d/check_mk_templates.cfg b/omd/packages/check_mk/skel/etc/nagios/conf.d/check_mk_templates.cfg
index a4a4348..f2fab28 100644
--- a/omd/packages/check_mk/skel/etc/nagios/conf.d/check_mk_templates.cfg
+++ b/omd/packages/check_mk/skel/etc/nagios/conf.d/check_mk_templates.cfg
@@ -294,7 +294,7 @@ define servicedependency {
# Calling check_mk with precompiled checks
define command {
command_name check-mk
- command_line python $USER4$/var/check_mk/precompiled/"$HOSTNAME$"
+ command_line $USER4$/bin/python $USER4$/var/check_mk/precompiled/"$HOSTNAME$"
}
# Use this variant of if you are working without precompiled
Module: check_mk
Branch: master
Commit: 31dc18e727a96def6b5e7ec95bf08fb33c2eb142
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=31dc18e727a96d…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed May 16 12:52:20 2018 +0200
Fix some typos in checkman/check_uniserv
Change-Id: I147be955f90a906f1d22948aa0d1863349aba6f5
---
checkman/check_uniserv | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/checkman/check_uniserv b/checkman/check_uniserv
index d1b59d8..ad093e5 100644
--- a/checkman/check_uniserv
+++ b/checkman/check_uniserv
@@ -4,13 +4,12 @@ catalog: agentless
license: GPL
distribution: check_mk
description:
- This check uses a tcp connect to monitor the Uniserv Service.
- Uniserv ( http://www.uniserv.com/ ) is a Data Management Service who offers
+ This check uses a TCP connect to monitor the Uniserv Service.
+ Uniserv ( http://www.uniserv.com/ ) is a Data Management Service which offers
diffrent services like Address Checks, Banking Data Checks etc.
- Whith this active check it is possible to querie one address and the response from
- uniserv against a regex, or you can simply try to receive the version number from uniserv to make
- sure that the service is reachable.
-
- This check can be configured by Wato.
+ Whith this active check it is possible to query one address. The response from uniserv
+ can then be matched against a regular expression. Alternatively, only the version number
+ from uniserv can be received to make sure that the service is reachable.
+ This check can be configured via Wato.