Module: check_mk
Branch: master
Commit: 7b81bc7ae942fcf95bf93a6b08da0443e19a9c39
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b81bc7ae942fc…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Dec 7 16:46:21 2017 +0100
Fix pylint breakage done by commit 0e6af0c11.
Change-Id: I782232ff0f21befa3d6e17252ac46d0a384112ad
---
web/htdocs/wato.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index ade11a3..8357a58 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16724,7 +16724,7 @@ class ModeAnalyzeConfig(WatoMode):
("_site_id", result.site_id),
("_status_id", result.status),
("_test_id", result.test_id)]),
- _("Unacknowledge this test result for site %s" % site_id),
+ _("Unacknowledge this test result for site %s") % site_id,
"unacknowledge_test",
)
else:
@@ -16734,7 +16734,7 @@ class ModeAnalyzeConfig(WatoMode):
("_site_id", result.site_id),
("_status_id", result.status),
("_test_id", result.test_id)]),
- _("Acknowledge this test result for site %s" % site_id),
+ _("Acknowledge this test result for site %s") % site_id,
"acknowledge_test",
)
else:
Module: check_mk
Branch: master
Commit: 0d9bf065fe00eb6859e6d9145ed837110dcab892
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0d9bf065fe00eb…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Dec 7 16:23:01 2017 +0100
5469 FIX Fixed acknowledgement notifications when RBN is disabled
When an ACKNOWLEDGE_{HOST,SVC}_PROBLEM command is issued to the core (via
the GUI or via Livestatus) and rule-based notifications are disabled, the
CMC segfaulted. This has been fixed.
Change-Id: Icb79639ec71459b57f22e3b8ce52502814c5fc5d
---
.werks/5469 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.werks/5469 b/.werks/5469
new file mode 100644
index 0000000..2ecce06
--- /dev/null
+++ b/.werks/5469
@@ -0,0 +1,12 @@
+Title: Fixed acknowledgement notifications when RBN is disabled
+Level: 1
+Component: core
+Compatible: compat
+Edition: cee
+Version: 1.5.0i2
+Date: 1512659905
+Class: fix
+
+When an ACKNOWLEDGE_{HOST,SVC}_PROBLEM command is issued to the core (via
+the GUI or via Livestatus) and rule-based notifications are disabled, the
+CMC segfaulted. This has been fixed.
Module: check_mk
Branch: master
Commit: 2204481095c117017c07aa8feca09ce984cf5a9c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2204481095c117…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu Dec 7 14:06:48 2017 +0100
df.include: Stop df_check_filesystem_list from returning perfvalues as strings with attached units
This does not appear to be used anymore by the PNP templates in question. The microcore and metric system
do not care at any rate.
Change-Id: Ifff1b539d88647143c52df65f4f5eedcbeb56134
---
checks/df.include | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/checks/df.include b/checks/df.include
index d61ce4d..093b867 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -346,8 +346,8 @@ def df_check_filesystem_single(mountpoint, size_mb, avail_mb, reserved_mb, inode
# TODO: In some future version use a fixed name as perf variable
perf_var = mountpoint.replace(" ", "_")
- perfdata = [(perf_var, str(used_mb) + 'MB', warn_mb, crit_mb, 0, size_mb),
- ('fs_size', str(size_mb) + 'MB')]
+ perfdata = [(perf_var, used_mb, warn_mb, crit_mb, 0, size_mb),
+ ('fs_size', size_mb)]
if type(params) == dict:
show_levels = params.get("show_levels")
Module: check_mk
Branch: master
Commit: e73d37753a7d61d0a1f37f2730429f0a41787fc5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e73d37753a7d61…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu Dec 7 11:19:10 2017 +0100
Check tests: Initial version of a class to be used to model basic check results.
Even the basic assertions it provides already uncover strange behavour of the df check.
Change-Id: Ica048a79723718fee7e54db649509754b901d12a
---
tests/checks/checktestlib.py | 32 ++++++++++++++++++++++++++++++++
tests/checks/test_df_check.py | 9 +++++----
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/tests/checks/checktestlib.py b/tests/checks/checktestlib.py
new file mode 100644
index 0000000..ee82e1d
--- /dev/null
+++ b/tests/checks/checktestlib.py
@@ -0,0 +1,32 @@
+
+class BasicCheckResult(object):
+ """A basic check result
+
+ This class models a basic check result (status, infotext, perfdata) and provides
+ facilities to match it against conditions, such as 'Status is...' or 'Infotext contains...'
+ """
+
+ def __init__(self, status, infotext, perfdata=None):
+ """We perform some basic consistency checks during initialization"""
+ assert status in [0,1,2,3]
+ assert type(infotext) == str
+ assert "\n" not in infotext
+ self.status = status
+ self.infotext = infotext
+ if perfdata is not None:
+ assert type(perfdata) == list
+ assert all([len(entry) >= 2 for entry in perfdata])
+
+ for entry in perfdata:
+ assert type(entry) == tuple
+ assert len(entry) >= 2
+
+ # TODO: This is very basic. There is more way more magic involved
+ # in what kind of values are allowed as metric names.
+ # I'm not too sure unicode should be allowed, either.
+ assert type(entry[0]) in [str, unicode]
+
+ assert type(entry[1]) in [int, float]
+ assert all(type(value) in [int, float, type(None)] for value in entry[2:])
+ self.perfdata = perfdata
+
diff --git a/tests/checks/test_df_check.py b/tests/checks/test_df_check.py
index 5bc8ccd..6331e43 100644
--- a/tests/checks/test_df_check.py
+++ b/tests/checks/test_df_check.py
@@ -1,5 +1,6 @@
import pytest
import pprint
+import checktestlib
pytestmark = pytest.mark.checks
@@ -265,10 +266,10 @@ def test_df_check_with_parse(check_manager, monkeypatch, item, params, info, exp
if params == "default":
params = check.default_parameters()
- result = check.run_check(item, params, check.run_parse(info))
+ result = checktestlib.BasicCheckResult(*check.run_check(item, params, check.run_parse(info)))
if "status" in expected_result:
- assert result[0] == expected_result["status"]
+ assert result.status == expected_result["status"]
if "infotext" in expected_result:
- assert result[1] == expected_result["infotext"]
+ assert result.infotext == expected_result["infotext"]
if "perfdata" in expected_result:
- assert result[2] == expected_result["perfdata"]
+ assert result.perfdata == expected_result["perfdata"]
Module: check_mk
Branch: master
Commit: 51da0046fba49d44c99ded7a4c8bde263f0d30f3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51da0046fba49d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 7 13:41:26 2017 +0100
AC Test helper usage: Only report too low usage when user increased the helpers
Change-Id: I267a35860c97bcf4111ac9dc401c349087306ab8
---
web/plugins/wato/ac_tests.py | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/web/plugins/wato/ac_tests.py b/web/plugins/wato/ac_tests.py
index 16b00c7..f20d7dc 100644
--- a/web/plugins/wato/ac_tests.py
+++ b/web/plugins/wato/ac_tests.py
@@ -506,7 +506,27 @@ class ACTestCheckMKHelperUsage(ACTest):
yield cls(_("The current Check_MK helper usage is %.2f%%. The Check_MK services have an "
"average check latency of %.3fs.") % (helper_usage_perc, check_latecy_cmk))
- if helper_usage_perc < 50:
+ default_values = watolib.ConfigDomain().get_all_default_globals()
+ def get_effective_global_setting(varname):
+ global_settings = watolib.load_configuration_settings()
+
+ if watolib.is_wato_slave_site():
+ current_settings = watolib.load_configuration_settings(site_specific=True)
+ else:
+ sites = watolib.SiteManagement.load_sites()
+ current_settings = sites[config.omd_site()].get("globals", {})
+
+ if varname in current_settings:
+ value = current_settings[varname]
+ elif varname in global_settings:
+ value = global_settings[varname]
+ else:
+ value = default_values[varname]
+
+ return value
+
+ # Only report this as warning in case the user increased the default helper configuration
+ if get_effective_global_setting("cmc_cmk_helpers") > default_values["cmc_cmk_helpers"] and helper_usage_perc < 50:
yield ACResultWARN(_("The helper usage is below 50%, you may decrease the number of "
"Check_MK helpers to reduce the memory consumption."))
Module: check_mk
Branch: master
Commit: 8a9a8c65f3520521b0f288a331c00d62cbfef1e4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a9a8c65f35205…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Dec 7 12:08:30 2017 +0100
Ignore the dreaded leaking file descriptor problem for now.
The problem of leaking file descriptors across fork()/exec() is a dark and
heavily disputed corner of many *nices, including Linux. In a nutshell:
It's a horrible design flaw, and there are basically two approaches of
working around it:
* First workaround: You directly open *all* your files with O_CLOEXEC,
but to do that atomically, you need a bunch of new system calls.
Naively using "fcntl(fd, F_SETFD, FD_CLOEXEC)" introduces a race
condition during the time between open() and fcntl() where a
fork()/exec() may happen. In addition you'll have various kinds of fun
trying to dup()/dup2()/dup3() your file descriptors correctly.
* Second workaround: Explicitly close all file descriptors you don't need
anymore before a fork()/exec(). This has various downsides, too: You
don't know exactly which file descriptors are open (think: libraries!),
and which of them should survive. Furhtermore, you can only pray that
your libraries either don't fork()/exec() or that they use the same
workaround as you.
Note that both approaches only really work if all SW components use the same
workaround, which is *far* from reality. Just a few entertaining references
to see that this is not a problem which is easy to solve and where everybody
agrees:
* glibc bug 10353 "Methods for deleting all file descriptors greater than
given integer" (https://sourceware.org/bugzilla/show_bug.cgi?id=10353):
Several people request glibc support for the 2nd workaround, but Ulrich
Drepper is as "friendly" and "open-minded" as usual and insists on the
1st workaround, ignoring its inherent problems... :-P
* Python issue 21207 "urandom persistent fd - not re-openned after fd
close" (https://bugs.python.org/issue21207): Some library uses the 2nd
workaround, but Python is not prepared for that.
* "Excuse me son, but your code is leaking !!!"
(http://danwalsh.livejournal.com/53603.html): One of many blog entries
advertising the first workaround.
* "I'm done with O_CLOEXEC"
(https://mail.gnome.org/archives/gtk-devel-list/2015-March/msg00038.html):
A rant from a core GNOME developer, saying goodbye to the 1st
workaround.
As a fun fact, ancient CentOS 5 ships with Linux 2.6.18 from 2006, but
O_CLOEXEC was introduced only in 2.6.23 from 2007. Furthermore, the
corresponding "e" modifier for fopen() was introduced in glibc 2.7 (2007),
but CentOS 5 ships with the brand-new, bleeding-edge glibc version 2.5 from
2006. :-/ So we can't use the 1st workaround yet, only when we drop support
for CentOS 5.
What the NEB/CMC currently does is a mixture of both workarounds, including
some hopefully harmless race conditions. This should be good enough for
now, but we should definitely come back to that dark corner at some point in
time.
Change-Id: Ic7f78e13acc866cea81ec87bb92fc58cd812d3a1
---
.clang-tidy | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.clang-tidy b/.clang-tidy
index ec71d61..aeabfec 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -15,6 +15,8 @@
# * llvm-include-order ("#includes are not sorted properly")
#
# * desirable checks, but hard to fix currently:
+# * android-cloexec-fopen ("use 'fopen' mode 'e' to set O_CLOEXEC") Ancient CentOS 5 doesn't have O_CLOEXEC
+# * android-cloexec-open ("'open' should use O_CLOEXEC where possible") Ancient CentOS 5 doesn't have O_CLOEXEC
# * cert-env33-c ("calling 'system' uses a command processor")
# * cert-err34-c ("'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead")
# * cppcoreguidelines-pro-type-member-init ("uninitialized record type: 'foo'")
@@ -27,7 +29,7 @@
# * cppcoreguidelines-pro-type-union-access ("do not access members of unions; use (boost::)variant instead")
# * modernize-use-bool-literals ("converting integer literal to bool, use bool literal instead") Incorrectly triggered by e.g. FD_ZERO
#
-Checks: '*,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-alpha*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-google-runtime-int,-google-runtime-references,-hicpp-member-init,-hicpp-no-assembler,-llvm-include-order,-modernize-use-bool-literals'
+Checks: '*,-android-cloexec-fopen,-android-cloexec-open,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-alpha*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-google-runtime-int,-google-runtime-references,-hicpp-member-init,-hicpp-no-assembler,-llvm-include-order,-modernize-use-bool-literals'
CheckOptions:
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '1'