Module: check_mk
Branch: master
Commit: 6350f2b4ef62bfe7e535f724fd8da4340d6a79b9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6350f2b4ef62bf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Mar 7 11:14:04 2014 +0100
Fix bulk notifications: would call non-bulk, too
---
modules/notify.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/notify.py b/modules/notify.py
index bc30f0f..aae996d 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -479,7 +479,8 @@ def notify_rulebased(raw_context, analyse=False):
do_bulk_notify(contact, plugin, params, plugin_context, bulk)
elif notification_spooling:
create_spoolfile({"context": plugin_context,
"plugin": plugin})
- call_notification_script(plugin, plugin_context)
+ else:
+ call_notification_script(plugin, plugin_context)
except Exception, e:
if opt_debug:
@@ -862,7 +863,8 @@ def notify_flexible(raw_context, notification_table):
if notification_spooling:
create_spoolfile({"context": plugin_context, "plugin":
plugin})
- call_notification_script(plugin, plugin_context)
+ else:
+ call_notification_script(plugin, plugin_context)
# may return
# 0 : everything fine -> proceed
@@ -1392,6 +1394,12 @@ def notify_bulk(dirname, uuids):
for varname, value in context.items():
bulk_context.append("%s=%s\n" % (varname, value))
+ # Do not forget to add this to the monitoring log. We create
+ # a single entry for each notification contained in the bulk.
+ # It is important later to have this precise information.
+ plugin_name = "bulk " + (plugin or "plain email")
+ core_notification_log(plugin_name, context)
+
parameter_context = [ "PARAMETERS=" + " ".join(old_params) +
"\n" ]
for nr, param in enumerate(old_params):
parameter_context.append("PARAMETER_%d=%s\n" % (nr + 1, param))