Module: check_mk
Branch: master
Commit: 16986a19974f507e227b7c025745d4b9cebc347b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=16986a19974f50…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 20 11:21:16 2016 +0200
3418 FIX Do not send host notifications if a service group is required
If you set a match condition on the service groups then for host notifications
this condition was ignored. But a host cannot be in any service group so now
if you use this condition then the rule will never match for host notifications.
This should be the way that you expect this.
---
.werks/3418 | 13 +++++++++++++
ChangeLog | 2 ++
modules/events.py | 8 ++++++--
web/htdocs/wato.py | 3 ++-
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.werks/3418 b/.werks/3418
new file mode 100644
index 0000000..a7ca4f5
--- /dev/null
+++ b/.werks/3418
@@ -0,0 +1,13 @@
+Title: Do not send host notifications if a service group is required
+Level: 2
+Component: notifications
+Class: fix
+Compatible: incomp
+State: unknown
+Version: 1.2.9i1
+Date: 1461143929
+
+If you set a match condition on the service groups then for host notifications
+this condition was ignored. But a host cannot be in any service group so now
+if you use this condition then the rule will never match for host notifications.
+This should be the way that you expect this.
diff --git a/ChangeLog b/ChangeLog
index 8463214..169d4f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -295,6 +295,8 @@
* 3253 FIX: sms: notification script sms now handles single quotes in the message in
the right way
* 3346 FIX: Re-added envelope sender to asciimail/mail notification plugins
* 3380 FIX: Fixed graphs in service notifications having spaces in service
descriptions
+ * 3418 FIX: Do not send host notifications if a service group is required...
+ NOTE: Please refer to the migration notes!
BI:
* 3271 New option in aggregation for tuning aggregation of downtimes...
diff --git a/modules/events.py b/modules/events.py
index 3f90de7..8d34e7d 100644
--- a/modules/events.py
+++ b/modules/events.py
@@ -332,9 +332,13 @@ def event_match_hosttags(rule, context):
def event_match_servicegroups(rule, context):
- if context["WHAT"] != "SERVICE":
- return
required_groups = rule.get("match_servicegroups")
+ if context["WHAT"] != "SERVICE":
+ if required_groups:
+ return "This rule requires membership in a service group, but this is a
host notification"
+ else:
+ return
+
if required_groups != None:
sgn = context.get("SERVICEGROUPNAMES")
if sgn == None:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 40f14c4..187a677 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7212,7 +7212,8 @@ def generic_rule_match_conditions():
( "match_servicegroups",
GroupChoice("service",
title = _("Match Service Groups"),
- help = _("The service must be in one of the selected service
groups"),
+ help = _("The service must be in one of the selected service groups.
For host events this condition "
+ "never matches as soon as at least one group is
selected."),
allow_empty = False,
)
),