Module: check_mk
Branch: master
Commit: 5af07e344bb19e1aadafc9a753508b322413e158
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5af07e344bb19e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 20 12:52:51 2016 +0200
3968 FIX Notifications / Alert handling: Fixed configuring nth notifications without state
changes
This is especially important for the Enterprise Edition specific alert handling when
constructing
rules matching on the nth check attempt. But it has been added as generic option for
notifications
and alert handling.
---
.werks/3968 | 12 ++++++++++++
ChangeLog | 1 +
modules/notify.py | 3 ++-
web/htdocs/wato.py | 13 ++++++++++++-
4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/.werks/3968 b/.werks/3968
new file mode 100644
index 0000000..6917c79
--- /dev/null
+++ b/.werks/3968
@@ -0,0 +1,12 @@
+Title: Notifications / Alert handling: Fixed configuring nth notifications without state
changes
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i2
+Date: 1476960641
+
+This is especially important for the Enterprise Edition specific alert handling when
constructing
+rules matching on the nth check attempt. But it has been added as generic option for
notifications
+and alert handling.
diff --git a/ChangeLog b/ChangeLog
index 8c5e40c..86bd489 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,7 @@
Notifications:
* 3957 mail: now allows extra HTML section between body and table
* 3900 FIX: Notification analysis: Fixed wrong color for host notification states
+ * 3968 FIX: Notifications / Alert handling: Fixed configuring nth notifications
without state changes...
BI:
* 3955 BI rule ID can now be renamed
diff --git a/modules/notify.py b/modules/notify.py
index a17de66..d0555e2 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -685,7 +685,8 @@ def rbn_match_event(context, state, last_state, events,
allowed_events):
# Now go through the allowed events. Handle '?' has matching all types!
for allowed in allowed_events:
if event == allowed or \
- event[0] == '?' and len(allowed) > 1 and event[1] == allowed[1]:
+ (allowed[0] == '?' and len(event) > 1 and event[1] == allowed[1])
or \
+ (event[0] == '?' and len(allowed) > 1 and event[1] ==
allowed[1]):
return
return "Event type '%s' not handled by this rule. Allowed are: %s"
% (
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 7174435..d9e70c5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7433,11 +7433,17 @@ def event_rule_match_conditions(flavour):
"types then this rule will never hold for service
notifications!"),
choices = [
( 'rd', _("UP") + u" ➤ " +
_("DOWN")),
- ( 'dr', _("DOWN") + u" ➤ " +
_("UP")),
( 'ru', _("UP") + u" ➤ " +
_("UNREACHABLE")),
+
+ ( 'dr', _("DOWN") + u" ➤ " +
_("UP")),
( 'du', _("DOWN") + u" ➤ " +
_("UNREACHABLE")),
+
( 'ud', _("UNREACHABLE") + u" ➤ " +
_("DOWN")),
( 'ur', _("UNREACHABLE") + u" ➤ " +
_("UP")),
+
+ ( '?r', _("any") + u" ➤ " +
_("UP")),
+ ( '?d', _("any") + u" ➤ " +
_("DOWN")),
+ ( '?u', _("any") + u" ➤ " +
_("UNREACHABLE")),
] + add_choices,
default_value = [ 'rd', 'dr', ] + add_default,
)
@@ -7467,6 +7473,11 @@ def event_rule_match_conditions(flavour):
( 'uw', _("UNKNOWN") + u" ➤ " +
_("WARN")),
( 'uc', _("UNKNOWN") + u" ➤ " +
_("CRIT")),
+ ( '?r', _("any") + u" ➤ " +
_("OK")),
+ ( '?w', _("any") + u" ➤ " +
_("WARN")),
+ ( '?c', _("any") + u" ➤ " +
_("CRIT")),
+ ( '?u', _("any") + u" ➤ " +
_("UNKNOWN")),
+
] + add_choices,
default_value = [ 'rw', 'rc', 'ru', 'wc',
'wu', 'uc', ] + add_default,
)