Module: check_mk
Branch: master
Commit: ad0aacd5af32f856ebe01f898f0b8f81cf198711
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad0aacd5af32f8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 31 14:40:45 2013 +0100
FIX Fix rule precedence in WATO-configured manual checks
When configuring rules for <i>Manual Checks</i> via WATO and
having several rules for the same combination of host, check type
and item, then the <i>last</i> of these rules would specify the
parameters of the check. This has now been fixed and the <i>first</i>
matching rule has precedence.
---
.werks/401 | 14 ++++++++++++++
ChangeLog | 1 +
modules/check_mk.py | 14 +++++++++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/401 b/.werks/401
new file mode 100644
index 0000000..957b4a6
--- /dev/null
+++ b/.werks/401
@@ -0,0 +1,14 @@
+Title: Fix rule precedence in WATO-configured manual checks
+Level: 1
+Component: core
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1388497148
+Targetversion: future
+
+When configuring rules for <i>Manual Checks</i> via WATO and
+having several rules for the same combination of host, check type
+and item, then the <i>last</i> of these rules would specify the
+parameters of the check. This has now been fixed and the <i>first</i>
+matching rule has precedence.
diff --git a/ChangeLog b/ChangeLog
index 567a1aa..bea7e32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
* 0379 FIX: check_mk -c: Now also rewrites the location of conf.d directory
* 0354 FIX: Catch exception when check plugins do not return a state...
* 0398 FIX: Tolerate debug output in check plugins when using CMC...
+ * 0401 FIX: Fix rule precedence in WATO-configured manual checks...
Checks & Agents:
* 0306 esx_vsphere_counters: added missing ramdisk levels sfcbtickets
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 1b723b5..b0dd374 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -5341,9 +5341,21 @@ def read_config_files(with_autochecks=True, with_conf_d=True):
params[key] = value
static.append((taglist, hostlist, checktype, item, params))
+
+ # Note: We need to reverse the order of the static_checks. This is because
+ # users assume that earlier rules have precedence over later ones. For static
+ # checks that is important if there are two rules for a host with the same
+ # combination of check type and item. When the variable 'checks' is
evaluated,
+ # *later* rules have precedence. This is not consistent with the rest, but a
+ # result of this "historic implementation".
+ static.reverse()
+
+ # Now prepend to checks. That makes that checks variable have precedence
+ # over WATO.
checks = static + checks
- # Read autochecks and append them to explicit checks
+ # Read autochecks and prepend them to explicit checks. That way autochecks
+ # will have the *least* precedence!
if with_autochecks:
read_all_autochecks()
checks = autochecks + checks