Module: check_mk
Branch: master
Commit: 3f14b643a69949665f66bb4760c1f467ea30b2be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3f14b643a69949…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 18 14:16:13 2013 +0100
Added mail command to notify env macros
---
ChangeLog | 2 +-
modules/notify.py | 14 ++++----------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8a5af39..67d37f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,7 +52,7 @@
* Added valuespec for cisco_mem check to configure thresholds via WATO
* FIX: Fixed displaying of tag selections when creating a rule in the ruleeditor
* FIX: Rulesets are always cloned in the same folder
- * Flexibile notifications: removed "debug notification" script from GUI
(you make it
+ * Flexibile notifications: removed "debug notification" script from GUI
(you can make it
executable to be choosable again)
* Flexibile notifications: added plain mail notification which uses the
mail templates from global settings dialog
diff --git a/modules/notify.py b/modules/notify.py
index db92845..4cedf1e 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -85,24 +85,16 @@ test_vars = {
'NOTIFY_HOSTSTATE': 'DOWN',
'NOTIFY_HOSTTAGS': 'cmk-agent prod lan tcp wato /wato/',
'NOTIFY_LASTHOSTSTATE': 'UP',
- 'NOTIFY_LASTSERVICESTATE': '$LASTSERVICESTATE$',
'NOTIFY_LOGDIR': '/omd/sites/event/var/check_mk/notify',
'NOTIFY_LONGDATETIME': 'Thu Jan 17 15:28:13 CET 2013',
'NOTIFY_LONGHOSTOUTPUT': '',
- 'NOTIFY_LONGSERVICEOUTPUT': '$LONGSERVICEOUTPUT$',
'NOTIFY_NOTIFICATIONTYPE': 'PROBLEM',
'NOTIFY_PARAMETERS': '',
- 'NOTIFY_SERVICECHECKCOMMAND': '$SERVICECHECKCOMMAND$',
- 'NOTIFY_SERVICEDESC': '$SERVICEDESC$',
- 'NOTIFY_SERVICENOTIFICATIONNUMBER': '$SERVICENOTIFICATIONNUMBER$',
- 'NOTIFY_SERVICEOUTPUT': '$SERVICEOUTPUT$',
- 'NOTIFY_SERVICEPERFDATA': '$SERVICEPERFDATA$',
- 'NOTIFY_SERVICEPROBLEMID': '$SERVICEPROBLEMID$',
- 'NOTIFY_SERVICESTATE': '$SERVICESTATE$',
'NOTIFY_SHORTDATETIME': '2013-01-17 15:28:13',
'NOTIFY_WHAT': 'HOST',
'NOTIFY_OMD_ROOT': '/omd/sites/event',
'NOTIFY_OMD_SITE': 'event',
+ 'NOTIFY_MAIL_COMMAND': 'mail -s \'$SUBJECT$\'
\'$CONTACTEMAIL$\'',
},
'service': {
'NOTIFY_CONTACTEMAIL': 'lm(a)mathias-kettner.de'.de',
@@ -139,6 +131,7 @@ test_vars = {
'NOTIFY_WHAT': 'SERVICE',
'NOTIFY_OMD_ROOT': '/omd/sites/event',
'NOTIFY_OMD_SITE': 'event',
+ 'NOTIFY_MAIL_COMMAND': 'mail -s \'$SUBJECT$\'
\'$CONTACTEMAIL$\'',
},
}
@@ -229,6 +222,7 @@ def do_notify(args):
context["OMD_SITE"] = os.getenv("OMD_SITE",
"")
context["WHAT"] = "SERVICEDESC" in context and
"SERVICE" or "HOST"
+ context["MAIL_COMMAND"] = notification_mail_command
# Handle interactive calls
if mode == 'fake-service':
@@ -377,7 +371,7 @@ def call_notification_script(plugin, parameters, context):
os.putenv("NOTIFY_PARAMETER_%d" % (nr + 1), value)
os.putenv("NOTIFY_LOGDIR", notification_logdir)
- for key in [ 'WHAT', 'OMD_ROOT', 'OMD_SITE' ]:
+ for key in [ 'WHAT', 'OMD_ROOT', 'OMD_SITE',
'MAIL_COMMAND' ]:
if key in context:
os.putenv('NOTIFY_' + key, context[key])