Module: check_mk
Branch: master
Commit: 7a0cb3db9cdea344a08956912763d1cf6d068e0e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a0cb3db9cdea3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 19 15:11:42 2016 +0100
4197 FIX Fix sending notification to global fallback email address
Change-Id: Ia0a0f38f9d63e87e7161f371c3c35a12403825cb
---
.werks/4197 | 9 +++++++++
ChangeLog | 4 ++++
modules/notify.py | 12 ++++++++----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/4197 b/.werks/4197
new file mode 100644
index 0000000..3b94294
--- /dev/null
+++ b/.werks/4197
@@ -0,0 +1,9 @@
+Title: Fix sending notification to global fallback email address
+Level: 2
+Component: notifications
+Compatible: compat
+Version: 1.4.0i4
+Date: 1482156687
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 122a8dd..bc6ac3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.4.0i4:
Checks & Agents:
* 4104 veeam_tapejobs: New check to monitor Veeam tape jobs
+ * 4170 local: local check is now clusteraware. Best or worst state in cluster mode
can be configured...
* 4171 FIX: perle_psmu: fixed value error...
* 4172 FIX: smart.temp: fixed discovery and check function...
@@ -11,6 +12,9 @@
* 4142 New extended search dialog for rulesets and rules...
* 4003 FIX: esx_vsphere_objects: fixed check parameters display bug during WATO
service discovery
+ Notifications:
+ * 4197 FIX: Fix sending notification to global fallback email address
+
Event Console:
* 4154 Do not send notifications if host found and currently in downtime...
NOTE: Please refer to the migration notes!
diff --git a/modules/notify.py b/modules/notify.py
index 06c8d11..a8f2f38 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -537,7 +537,7 @@ def user_notification_rules():
def rbn_fake_email_contact(email):
return {
- "name" : email,
+ "name" : "mailto:" + email,
"alias" : "Explicit email adress " + email,
"email" : email,
"pager" : "",
@@ -666,7 +666,7 @@ def rbn_match_event(context, state, last_state, events,
allowed_events):
def rbn_rule_contacts(rule, context):
the_contacts = set([])
if rule.get("contact_object"):
- the_contacts.update(rbn_object_contacts(context))
+ the_contacts.update(rbn_object_contact_names(context))
if rule.get("contact_all"):
the_contacts.update(rbn_all_contacts())
if rule.get("contact_all_with_email"):
@@ -680,7 +680,11 @@ def rbn_rule_contacts(rule, context):
all_enabled = []
for contactname in the_contacts:
- contact = contacts.get(contactname)
+ if contactname == notification_fallback_email:
+ contact = rbn_fake_email_contact(notification_fallback_email)
+ else:
+ contact = contacts.get(contactname)
+
if contact:
if contact.get("disable_notifications", False):
notify_log(" - skipping contact %s: he/she has disabled
notifications" % contactname)
@@ -776,7 +780,7 @@ def rbn_match_event_console(rule, context):
context["EC_COMMENT"],
match_ec["match_comment"])
-def rbn_object_contacts(context):
+def rbn_object_contact_names(context):
commasepped = context.get("CONTACTS")
if commasepped == "?":
notify_log("Warning: Contacts of %s cannot be determined. Using fallback
contacts" %