Module: check_mk
Branch: master
Commit: 9d88d55cd0bb794d19eab9529eb992b035dd6004
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9d88d55cd0bb79…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Jun 29 18:18:13 2018 +0200
6118 Add a analyze configuration rule for flexible and plain email notifications
A deprecation warning will be shown if rulebased notifications are deactivated
since flexible and plain email notifications are considered deprecated in
version 1.5.0 and will be removed in version 1.6.0. Please consider to
switch to rulebased notifications.
Change-Id: Ibdb7d45eebdacec1cbb2c033aaef5f1b70e5cb70
---
.werks/6118 | 12 ++++++++++++
web/plugins/wato/ac_tests.py | 25 ++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/.werks/6118 b/.werks/6118
new file mode 100644
index 0000000..6653801
--- /dev/null
+++ b/.werks/6118
@@ -0,0 +1,12 @@
+Title: Add a analyze configuration rule for flexible and plain email notifications
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1530288849
+Class: feature
+
+A deprecation warning will be shown if rulebased notifications are deactivated
+since flexible and plain email notifications are considered deprecated and will
+be removed in the next release.
diff --git a/web/plugins/wato/ac_tests.py b/web/plugins/wato/ac_tests.py
index f73b850..96db7a3 100644
--- a/web/plugins/wato/ac_tests.py
+++ b/web/plugins/wato/ac_tests.py
@@ -748,7 +748,30 @@ class ACTestESXDatasources(ACTest):
in ['agent', 'hostsystem_agent'])
if vsphere_queries_agent:
all_rules_ok = False
- yield ACResultCRIT("Rule %d in Folder %s is affected" % (rule_index + 1, folder.title()))
+ yield ACResultCRIT(_("Rule %d in Folder %s is affected") % (rule_index + 1, folder.title()))
if all_rules_ok:
yield ACResultOK(_("No configured rules are affected"))
+
+
+class ACTestRulebasedNotifications(ACTest):
+ def category(self):
+ return ACTestCategories.deprecations
+
+ def title(self):
+ return _("Flexible and plain email notifications")
+
+ def help(self):
+ return _("Flexible and plain email notifications are considered deprecated in version 1.5.0 and "
+ " will be removed in Check_MK version 1.6.0. Please consider to switch to rulebased "
+ "notifications.")
+
+ def is_relevant(self):
+ return True
+
+ def execute(self):
+ settings = watolib.load_configuration_settings()
+ if settings['enable_rulebased_notifications'] != True:
+ yield ACResultCRIT('Rulebased notifications are deactivated in the global settings')
+ else:
+ yield ACResultOK(_("Rulebased notifications are activated"))
Module: check_mk
Branch: master
Commit: 3bca050d2679e64ca78a733ccb357c52f3c85cc3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3bca050d2679e6…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jul 3 13:18:34 2018 +0200
checktestlib: be more verbose in assertions
Change-Id: Ifc6d0e138cbe43ae8154abb060a749d1a5ffc852
---
tests/unit/checks/checktestlib.py | 73 ++++++++++++++++++++++++---------------
1 file changed, 45 insertions(+), 28 deletions(-)
diff --git a/tests/unit/checks/checktestlib.py b/tests/unit/checks/checktestlib.py
index a3fbc47..6a8f83f 100644
--- a/tests/unit/checks/checktestlib.py
+++ b/tests/unit/checks/checktestlib.py
@@ -29,31 +29,38 @@ class PerfValue(Tuploid):
"""Represents a single perf value"""
def __init__(self, key, value, warn=None, crit=None, minimum=None, maximum=None):
+ self.key = key
+ self.value = value
+ self.warn = warn
+ self.crit = crit
+ self.minimum = minimum
+ self.maximum = maximum
+
# 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(key) in [str, unicode]
- assert " " not in key # This leads to serious errors
- assert "=" not in key # The parsing around this is way too funky and doesn't work properly
+ assert type(key) in [str, unicode],\
+ "key %r must be of type str or unicode" % key
+ # Whitespace leads to serious errors
+ assert len(key.split()) == 1, \
+ "key %r must not contain whitespaces" % key
+ # Parsing around this is way too funky and doesn't work properly
+ assert "=" not in key, "key %r must not contain '='" % key
assert "\n" not in key
- self.key = key
-
# NOTE: The CMC as well as all other Nagios-compatible cores do accept a
# string value that may contain a unit, which is in turn available
# for use in PNP4Nagios templates. Check_MK defines its own semantic
# context for performance values using Check_MK metrics. It is therefore
# preferred to return a "naked" scalar.
- assert type(value) in [int, float]
- self.value = value
-
- assert type(warn) in [int, float, types.NoneType]
- self.warn = warn
- assert type(crit) in [int, float, types.NoneType]
- self.crit = crit
- assert type(minimum) in [int, float, types.NoneType]
- self.minimum = minimum
- assert type(maximum) in [int, float, types.NoneType]
- self.maximum = maximum
+ assert type(value) in [int, float],\
+ "value %r must be of type int or float - not %r" % (value, type(value))
+ msg = "%s parameter %r must be of type int, float or None - not %r"
+ assert type(warn) in [int, float, types.NoneType], msg % ('warn', warn, type(warn))
+ assert type(crit) in [int, float, types.NoneType], msg % ('crit', crit, type(crit))
+ assert type(minimum) in [int, float, types.NoneType], \
+ msg % ('minimum', minimum, type(minimum))
+ assert type(maximum) in [int, float, types.NoneType], \
+ msg % ('maximum', maximum, type(maximum))
@property
def tuple(self):
@@ -75,10 +82,11 @@ class BasicCheckResult(Tuploid):
def __init__(self, status, infotext, perfdata=None):
"""We perform some basic consistency checks during initialization"""
- assert status in [0, 1, 2, 3]
+ assert status in [0, 1, 2, 3], "invalid status: %r" % status
self.status = status
- assert type(infotext) in [ str, unicode ]
+ assert type(infotext) in [str, unicode],\
+ "infotext %r must be of type str or unicode" % infotext
if "\n" in infotext:
self.infotext, \
@@ -88,11 +96,13 @@ class BasicCheckResult(Tuploid):
self.multiline = None
if perfdata is not None:
- assert type(perfdata) == list
+ assert type(perfdata) == list,\
+ "perfdata %r must be of type list" % perfdata
self.perfdata = []
for entry in perfdata:
- assert type(entry) in [tuple, PerfValue]
+ assert type(entry) in [tuple, PerfValue],\
+ "perfdata entry %r must be of type tuple or PerfValue" % entry
if type(entry) is tuple:
self.perfdata.append(PerfValue(*entry))
else:
@@ -179,13 +189,17 @@ def assertCheckResultsEqual(actual, expected):
This gives more helpful output than 'assert actual == expected'
"""
if isinstance(actual, BasicCheckResult):
- assert isinstance(expected, BasicCheckResult)
+ assert isinstance(expected, BasicCheckResult), \
+ "%r is not a BasicCheckResult instance" % expected
assert actual == expected, "%s != %s" % (actual, expected)
else:
- assert isinstance(actual, CheckResult)
- assert isinstance(expected, CheckResult)
- assert len(actual.subresults) == len(expected.subresults)
+ assert isinstance(actual, CheckResult), \
+ "%r is not a CheckResult instance" % actual
+ assert isinstance(expected, CheckResult), \
+ "%r is not a CheckResult instance" % expected
+ assert len(actual.subresults) == len(expected.subresults), \
+ "subresults not of equal length"
for suba, sube in zip(actual.subresults, expected.subresults):
assert suba == sube, "%r != %r" % (suba, sube)
@@ -247,9 +261,12 @@ def assertDiscoveryResultsEqual(actual, expected):
This gives more helpful output than 'assert actual == expected'
"""
- assert isinstance(actual, DiscoveryResult)
- assert isinstance(expected, DiscoveryResult)
- assert len(actual.entries) == len(expected.entries)
+ assert isinstance(actual, DiscoveryResult), \
+ "%r is not a DiscoveryResult instance" % actual
+ assert isinstance(expected, DiscoveryResult), \
+ "%r is not a DiscoveryResult instance" % expected
+ assert len(actual.entries) == len(expected.entries), \
+ "DiscoveryResults are not of equal length"
for enta, ente in zip(actual, expected):
assert enta == ente, "%r != %r" % (enta, ente)
@@ -272,7 +289,7 @@ class BasicItemState(object):
msg = "time_diff should be of type float/int - not %r"
assert time_diff_type in (float, int), msg % time_diff_type
# We do allow negative time diffs.
- # We want to ba able to test time anomalies.
+ # We want to be able to test time anomalies.
class MockItemState(object):
Module: check_mk
Branch: master
Commit: 22e180abfccd0461ac5906ff304b5ed29acc81ff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=22e180abfccd04…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 3 14:51:47 2018 +0200
6320 FIX Some services (e.g. Linux Memory) were using wrong perfometers
Change-Id: Icdb9074f706e394a3dddd84a2b9733fd89755e84
---
.werks/6320 | 11 +++++++++++
web/htdocs/metrics.py | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/.werks/6320 b/.werks/6320
new file mode 100644
index 0000000..b648204
--- /dev/null
+++ b/.werks/6320
@@ -0,0 +1,11 @@
+Title: Some services (e.g. Linux Memory) were using wrong perfometers
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1530622280
+
+
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index bc6aa27..8cc4069 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -575,6 +575,12 @@ def parse_perf_data(perf_data_string, check_command=None):
varname, values = part.split("=", 1)
varname = cmk.utils.pnp_cleanup(varname.replace("\"", "").replace("\'", ""))
+ # Enforce varname to be a byte string for the moment. The plugins currently register
+ # the plugins with byte string varnames. In the long term this needs to be cleaned up
+ # to be unicode strings just like all internal strings. But for the moment the mixup
+ # would confuse e.g. dict lookups etc.
+ varname = varname.encode("utf-8")
+
value_parts = values.split(";")
while len(value_parts) < 5:
value_parts.append(None)