Module: check_mk
Branch: master
Commit: 4d3ea891a4297d26a9c2987c7bfca96ab94f12c3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d3ea891a4297d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 23 15:42:46 2018 +0100
5864 FIX Host- and service state filters were not set when adding a filtered view to a dashboard
The filters for filtering a view by the state of hosts or services were not correctly set in
view dashlets when the dashlets were created by adding it from a manually filtered existing
view.
Change-Id: Ibc5b1d7e218899df7a3f699583e3369c5fd3aae2
---
.werks/5864 | 13 +++++++++++++
web/plugins/visuals/filters.py | 42 ++++++++++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/.werks/5864 b/.werks/5864
new file mode 100644
index 0000000..c8d7af3
--- /dev/null
+++ b/.werks/5864
@@ -0,0 +1,13 @@
+Title: Host- and service state filters were not set when adding a filtered view to a dashboard
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i4
+Date: 1519396855
+
+The filters for filtering a view by the state of hosts or services were not correctly set in
+view dashlets when the dashlets were created by adding it from a manually filtered existing
+view.
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index cc5c006..f31cc59 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -487,21 +487,34 @@ declare_filter(210, FilterQueryDropdown("check_command", _("Service check comman
class FilterServiceState(Filter):
def __init__(self, name, title, prefix):
Filter.__init__(self, name, title,
- "service", [ prefix + "st0", prefix + "st1", prefix + "st2", prefix + "st3", prefix + "stp" ], [])
+ "service", [ prefix + "_filled", prefix + "st0", prefix + "st1", prefix + "st2", prefix + "st3", prefix + "stp" ], [])
self.prefix = prefix
def display(self):
html.begin_checkbox_group()
+ html.hidden_field(self.prefix + "filled", "1", add_var=True)
for var, text in [(self.prefix + "st0", _("OK")), (self.prefix + "st1", _("WARN")), \
(self.prefix + "st2", _("CRIT")), (self.prefix + "st3", _("UNKNOWN")),
(self.prefix + "stp", _("PEND"))]:
- html.checkbox(var, True, label=text)
+ html.checkbox(var, True if not self._filter_used() else False, label=text)
html.end_checkbox_group()
+ def _filter_used(self):
+ return html.has_var(self.prefix + "_filled") or html.has_var_prefix(self.prefix + "st")
+
def filter(self, infoname):
headers = []
for i in [0,1,2,3]:
- if html.get_checkbox(self.prefix + "st%d" % i) == False:
+ check_result = html.get_checkbox(self.prefix + "st%d" % i)
+
+ # When a view is displayed e.g. as a dashlet the unchecked checkboxes are not set in
+ # the HTML variables while the form was not interactively submitted. In this case the
+ # check_result is None intead of False. Since any of the filter variables is set, we
+ # do treat this as if the form was submitted and the checkbox was unchecked.
+ if self._filter_used() and check_result is None:
+ check_result = False
+
+ if check_result == False:
if self.prefix == "hd":
column = "service_last_hard_state"
else:
@@ -509,8 +522,10 @@ class FilterServiceState(Filter):
headers.append("Filter: %s = %d\n"
"Filter: service_has_been_checked = 1\n"
"And: 2\nNegate:\n" % (column, i))
+
if html.get_checkbox(self.prefix + "stp") == False:
headers.append("Filter: service_has_been_checked = 1\n")
+
if len(headers) == 5: # none allowed = all allowed (makes URL building easier)
return ""
else:
@@ -522,24 +537,39 @@ declare_filter(216, FilterServiceState("svchardstate", _("Service hard states"),
class FilterHostState(Filter):
def __init__(self):
Filter.__init__(self, "hoststate", _("Host states"),
- "host", [ "hst0", "hst1", "hst2", "hstp" ], [])
+ "host", [ "hoststate_filled", "hst0", "hst1", "hst2", "hstp" ], [])
def display(self):
html.begin_checkbox_group()
+ html.hidden_field("hoststate_filled", "1", add_var=True)
for var, text in [("hst0", _("UP")), ("hst1", _("DOWN")),
("hst2", _("UNREACH")), ("hstp", _("PENDING"))]:
- html.checkbox(var, True, label=text)
+ html.checkbox(var, True if not self._filter_used() else False, label=text)
html.end_checkbox_group()
+ def _filter_used(self):
+ return html.has_var("hoststate_filled") or html.has_var_prefix("hst")
+
def filter(self, infoname):
headers = []
for i in [0,1,2]:
- if html.get_checkbox("hst%d" % i) == False:
+ check_result = html.get_checkbox("hst%d" % i)
+
+ # When a view is displayed e.g. as a dashlet the unchecked checkboxes are not set in
+ # the HTML variables while the form was not interactively submitted. In this case the
+ # check_result is None intead of False. Since any of the filter variables is set, we
+ # do treat this as if the form was submitted and the checkbox was unchecked.
+ if self._filter_used() and check_result is None:
+ check_result = False
+
+ if check_result == False:
headers.append("Filter: host_state = %d\n"
"Filter: host_has_been_checked = 1\n"
"And: 2\nNegate:\n" % i)
+
if html.get_checkbox("hstp") == False:
headers.append("Filter: host_has_been_checked = 1\n")
+
if len(headers) == 4: # none allowed = all allowed (makes URL building easier)
return ""
else:
Module: check_mk
Branch: master
Commit: 95b01bfed7f100068e13f15ac9f5274bace690ef
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=95b01bfed7f100…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 23 14:09:59 2018 +0100
5863 FIX Windows agent sections: Fixed incompatibility with rules created before 1.4.0p14
The werk 5378 (1.4.0p14) renamed an agent section from "webservices" to "wmi_webservices" to fix
a bug. Rules created with the previous definition could not be translated to the new ruleset.
The translation has now been added to be able to edit the old rules again.
Change-Id: Iba80730ef445065906ba69b8d3fad8e03218caa7
---
.werks/5862 | 2 +-
.werks/5863 | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5862 b/.werks/5862
index c69d2ed..b1350c0 100644
--- a/.werks/5862
+++ b/.werks/5862
@@ -1,4 +1,4 @@
-Title: Wiondows agent sections: Fixed incompatibility with rules created before 1.4.0p22
+Title: Windows agent sections: Fixed incompatibility with rules created before 1.4.0p22
Level: 1
Component: wato
Class: fix
diff --git a/.werks/5863 b/.werks/5863
new file mode 100644
index 0000000..d65f191
--- /dev/null
+++ b/.werks/5863
@@ -0,0 +1,13 @@
+Title: Windows agent sections: Fixed incompatibility with rules created before 1.4.0p14
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i4
+Date: 1519391348
+
+The werk 5378 (1.4.0p14) renamed an agent section from "webservices" to "wmi_webservices" to fix
+a bug. Rules created with the previous definition could not be translated to the new ruleset.
+The translation has now been added to be able to edit the old rules again.
Module: check_mk
Branch: master
Commit: b1232628c90763d84282da0ba806a8b214c80272
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b1232628c90763…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Fri Feb 23 13:53:12 2018 +0100
5705 FIX Restore support for 32 bit Windows
Support for at least older 32 bit Windows versions was accidentally
dropped in 1.5.0i1. As a result, an error about missing procedure in
ntdll.dll was shown. Now the support is restored and the Windows agent
should work correctly also on all 32 bit systems.
---
.werks/5705 | 15 +++++++++++++++
agents/windows/Makefile.am | 2 +-
agents/windows/build_version | 2 +-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.werks/5705 b/.werks/5705
new file mode 100644
index 0000000..962d1aa
--- /dev/null
+++ b/.werks/5705
@@ -0,0 +1,15 @@
+Title: Restore support for 32 bit Windows
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1519390179
+Class: fix
+
+Support for at least older 32 bit Windows versions was accidentally
+dropped in 1.5.0i1. As a result, an error about missing procedure in
+ntdll.dll was shown. Now the support is restored and the Windows agent
+should work correctly also on all 32 bit systems.
+
+
diff --git a/agents/windows/Makefile.am b/agents/windows/Makefile.am
index 6d26b0c..0d01e6f 100644
--- a/agents/windows/Makefile.am
+++ b/agents/windows/Makefile.am
@@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = foreign
AM_CPPFLAGS = -O2 -Wformat=2 -Werror -Wall -fno-rtti -std=c++17 -gdwarf-2 \
-DCHECK_MK_VERSION='"$(VERSION)"' -D__USE_MINGW_ANSI_STDIO -DSI_SUPPORT_IOSTREAMS
AM_LDFLAGS = -static -static-libgcc -static-libstdc++
-LD_COMMON = -lwsock32 -lws2_32 -lole32 -loleaut32 -lwbemuuid -lpsapi -lshlwapi -limagehlp -lntdll -lstdc++fs
+LD_COMMON = -lwsock32 -lws2_32 -lole32 -loleaut32 -lwbemuuid -lpsapi -lshlwapi -limagehlp -lstdc++fs
check_mk_agent_LDADD = check_mk_agent.res libcheck_mk_agent.a $(LD_COMMON)
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 9a1248b..5fd68c5 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-3112
+3114
Module: check_mk
Branch: master
Commit: 28f8d6933a77b48461383fc872df22381bb5c37a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28f8d6933a77b4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 23 13:47:43 2018 +0100
5862 FIX Wiondows agent sections: Fixed incompatibility with rules created before 1.4.0p22
The werk 5415 (1.4.0p22) renamed an agent section from "ohm" to "openhardwaremonitor" to fix
a bug. Rules created with the previous definition could not be translated to the new ruleset.
The translation has now been added to be able to edit the old rules again.
Change-Id: Ic4d8c35f225a530289ec29268af20190559956b2
---
.werks/5862 | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/.werks/5862 b/.werks/5862
new file mode 100644
index 0000000..c69d2ed
--- /dev/null
+++ b/.werks/5862
@@ -0,0 +1,13 @@
+Title: Wiondows agent sections: Fixed incompatibility with rules created before 1.4.0p22
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i4
+Date: 1519389923
+
+The werk 5415 (1.4.0p22) renamed an agent section from "ohm" to "openhardwaremonitor" to fix
+a bug. Rules created with the previous definition could not be translated to the new ruleset.
+The translation has now been added to be able to edit the old rules again.
Module: check_mk
Branch: master
Commit: 4f96ab5da30b3b62e612d257adf5b02063adcacc
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f96ab5da30b3b…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Feb 23 12:34:53 2018 +0100
Use event pipe path from Settings.
Change-Id: Id7b82611d109b070e8ce1074ff5cddc6f4e7b965
---
bin/mkeventd | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index e9d0686..0f82f07 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -76,7 +76,6 @@ logger = cmk.log.get_logger("mkeventd")
# '----------------------------------------------------------------------'
# TODO(sp) Use cmk.ec.settings
-g_pipe_path = os.path.join(cmk.paths.omd_root, "tmp/run/mkeventd/events")
g_state_dir = os.path.join(cmk.paths.omd_root, "var/mkeventd")
g_main_config_path = os.path.join(cmk.paths.default_config_dir, "mkeventd.mk")
g_config_dir = os.path.join(cmk.paths.default_config_dir, "mkeventd.d")
@@ -1371,19 +1370,20 @@ class EventServer(ECServerThread):
]
def create_pipe(self):
+ path = g_settings.paths.event_pipe.value
try:
- if not stat.S_ISFIFO(os.stat(g_pipe_path).st_mode):
- os.remove(g_pipe_path)
+ if not path.is_fifo():
+ path.unlink()
except Exception:
pass
- if not os.path.exists(g_pipe_path):
- os.mkfifo(g_pipe_path)
+ if not path.exists():
+ os.mkfifo(str(path))
# We want to be able to receive events from all users on the local system
- os.chmod(g_pipe_path, 0o666) # nosec
+ path.chmod(0o666) # nosec
- self.logger.info("Created FIFO '%s' for receiving events" % g_pipe_path)
+ self.logger.info("Created FIFO '%s' for receiving events" % path)
def open_syslog(self):
endpoint = self.settings.options.syslog_udp
@@ -1449,7 +1449,7 @@ class EventServer(ECServerThread):
# select() will trigger even if there is no data. A good article
# about this is here:
# http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/
- return os.open(g_pipe_path, os.O_RDWR | os.O_NONBLOCK)
+ return os.open(str(g_settings.paths.event_pipe.value), os.O_RDWR | os.O_NONBLOCK)
def load_mibs(self):
try:
@@ -3771,7 +3771,7 @@ class StatusServer(ECServerThread):
# lock_eventstatus too. The lock can not be allocated twice.
# TODO: Change the lock type in future?
# process_raw_lines("%s" % ";".join(arguments))
- with file(g_pipe_path, "w") as pipe:
+ with file(str(g_settings.paths.event_pipe.value), "w") as pipe:
pipe.write(("%s\n" % ";".join(arguments)).encode("utf-8"))
def handle_command_changestate(self, arguments):
@@ -5108,7 +5108,7 @@ if __name__ == "__main__":
logger.info("Removed orphaned PID file %s (process %d not running anymore)." % (pid_path, old_pid))
# Make sure paths exist
- make_parentdirs(g_pipe_path)
+ g_settings.paths.event_pipe.value.parent.mkdir(parents=True, exist_ok=True)
make_parentdirs(g_state_dir + "/state")
# First do all things that might fail, before daemonizing
@@ -5151,7 +5151,7 @@ if __name__ == "__main__":
# to write into the pipe.
logger.verbose("Cleaning up event pipe")
pipe = g_event_server.open_pipe() # Open it
- os.remove(g_pipe_path) # Remove pipe
+ g_settings.paths.event_pipe.value.unlink() # Remove pipe
drain_pipe(pipe) # Drain any data
os.close(pipe) # Close pipe
Module: check_mk
Branch: master
Commit: 1dadc25e78ea1afb54ac4e3b056046b2a48d2769
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1dadc25e78ea1a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Feb 23 12:29:16 2018 +0100
Added link to blog article.
Change-Id: I10d65175f3a8a6a5c1f5f000e224daf4f56e29b6
---
cmk/ec/settings.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmk/ec/settings.py b/cmk/ec/settings.py
index d25998e..f66ce63 100644
--- a/cmk/ec/settings.py
+++ b/cmk/ec/settings.py
@@ -27,6 +27,10 @@
from __future__ import print_function
+# For some background about various design decisions below, see the concise
+# but excellent article "Parsing Command Line Arguments" in the FPComplete blog
+# at https://www.fpcomplete.com/blog/2017/12/parsing-command-line-arguments.
+
# NOTE: pylint/astroid doesn't fully understand typing annotations and the
# typing module yet, so we may have to suppress some things, see e.g. the
# issues https://github.com/PyCQA/pylint/issues/1063 for unused-import and