Module: check_mk
Branch: master
Commit: c8bc1e55ec929892cc06a1e30ccd25b90a77cda7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c8bc1e55ec9298…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 26 11:20:04 2016 +0100
#3245 FIX Fix interpretation of check levels 0.0 as "no levels"
E.g. if you have set 0/0 as warn/crit levels for CPU load then the service
would always be OK. This has now been fixed.
---
.werks/3245 | 11 +++++++++++
ChangeLog | 1 +
modules/check_mk_base.py | 6 +++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/3245 b/.werks/3245
new file mode 100644
index 0000000..d951621
--- /dev/null
+++ b/.werks/3245
@@ -0,0 +1,11 @@
+Title: Fix interpretation of check levels 0.0 as "no levels"
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456481952
+
+E.g. if you have set 0/0 as warn/crit levels for CPU load then the service
+would always be OK. This has now been fixed.
diff --git a/ChangeLog b/ChangeLog
index 642d6c0..3f0091e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,7 @@
* 3082 FIX: windows agent: with realtime updates active, shutting down the agent
could take very long
* 2997 FIX: Fixed broken SNMP subchecks...
* 3243 FIX: Fix missing custom graphs in sidebar snapin Views if explicit topic is
set
+ * 3245 FIX: Fix interpretation of check levels 0.0 as "no levels"...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index a8dc72f..a9d7322 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -2082,7 +2082,11 @@ def check_levels(value, dsname, params, unit="",
factor=1.0, scale=1.0, statemar
perfdata = []
infotexts = []
- scale_value = lambda v: v != None and v * factor * scale or None
+ def scale_value(v):
+ if v == None:
+ return None
+ else:
+ return v * factor * scale
# None or (None, None) -> do not check any levels
if params == None or params == (None, None):