Module: check_mk
Branch: master
Commit: 99b88b73a624f11890b4deefc5bfb749480c6472
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99b88b73a624f1…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Jan 21 11:27:50 2016 +0100
#2935 a notification can now match multiple event console rules
---
.werks/2935 | 9 +++++++++
ChangeLog | 1 +
modules/notify.py | 2 +-
web/htdocs/wato.py | 9 ++++++++-
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/2935 b/.werks/2935
new file mode 100644
index 0000000..1df76ea
--- /dev/null
+++ b/.werks/2935
@@ -0,0 +1,9 @@
+Title: a notification can now match multiple event console rules
+Level: 1
+Component: notifications
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453371980
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 664549d..872a8a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -270,6 +270,7 @@
Notifications:
* 2811 Mail notifications: Now able to add Host/Service Notes Url...
+ * 2935 a notification can now match multiple event console rules
* 2728 FIX: Removed debug notification script (was not executable)...
* 2843 FIX: Hanging notification scripts could prevent all other notifications...
* 2815 FIX: Notification scripts: Fixed missing environment variables...
diff --git a/modules/notify.py b/modules/notify.py
index 55246f5..c134718 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -721,7 +721,7 @@ def rbn_match_event_console(rule, context):
if match_ec != False:
# Match Event Console rule ID
- if "match_rule_id" in match_ec and context["EC_RULE_ID"]
!= match_ec["match_rule_id"]:
+ if "match_rule_id" in match_ec and context["EC_RULE_ID"]
not in match_ec["match_rule_id"]:
return "EC Event has rule ID '%s', but '%s' is
required" % (
context["EC_RULE_ID"],
match_ec["match_rule_id"])
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d089fca..2e9e43a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7469,7 +7469,14 @@ def notification_rule_match_conditions():
title = _("Match only Event Console alerts"),
elements = [
( "match_rule_id",
- ID(title = _("Match event rule"), label =
_("Rule ID:"), size=12, allow_empty=False),
+ Transform(
+ ListOf(
+ ID(title = _("Match event rule"), label =
_("Rule ID:"), size=12, allow_empty=False),
+ add_label = _("Add Rule ID"),
+ title = _("Rule IDs")
+ ),
+ forth = lambda x: isinstance(x, list) and x or [x]
+ )
),
( "match_priority",
Tuple(