[omd-commits] OMD Git: omd: notifications: added notification comment

git version control git at mathias-kettner.de
Thu Dec 8 09:48:45 CET 2011


Module:   omd
Branch:   master
Commit:   834da6bd69ed491fbdb6bf5aba4beec9d7b74ff1
URL:      http://omdistro.org/projects/omd/repository/revisions/834da6bd69ed491fbdb6bf5aba4beec9d7b74ff1

Author:   Sven Nierlein <sven at nierlein.de>
Date:     Thu Dec  8 09:48:20 2011 +0100
Commiter: Sven Nierlein <sven at nierlein.de>
Date:     Thu Dec  8 09:48:20 2011 +0100

notifications: added notification comment

---

 packages/notifications-tt/notify-by-email.pl       |    1 +
 .../etc/mail-templates/notify-by-email.host.tpl    |    4 ++++
 .../etc/mail-templates/notify-by-email.service.tpl |    4 ++++
 .../etc/nagios/conf.d/notification_commands.cfg    |    2 ++
 4 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/packages/notifications-tt/notify-by-email.pl b/packages/notifications-tt/notify-by-email.pl
index ea5d770..b2bfb5a 100755
--- a/packages/notifications-tt/notify-by-email.pl
+++ b/packages/notifications-tt/notify-by-email.pl
@@ -44,6 +44,7 @@ sub process_template {
 		$data .= "$_";
 	}
 	close FILE;
+	map($macro{$_} =~ s/\\n/\n/gmx, keys %macro);
 	my $template = Template->new({PRE_CHOMP => 1, POST_CHOMP => 0});
 	$template->process(\$data, \%macro, \$output);
 	print $output if $verbose;
diff --git a/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.host.tpl b/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.host.tpl
index f520577..37adf13 100644
--- a/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.host.tpl
+++ b/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.host.tpl
@@ -22,3 +22,7 @@ TO: [% CONTACTEMAIL %]
 - Comment:     [% ACKCOMMENT %]
 [% END %]
 ----------------------------------
+[% IF NOTIFICATIONCOMMENT %]
+- Comment:     [% NOTIFICATIONCOMMENT %]
+----------------------------------
+[% END %]
diff --git a/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.service.tpl b/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.service.tpl
index b1c6665..2fb0001 100644
--- a/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.service.tpl
+++ b/packages/notifications-tt/skel/etc/mail-templates/notify-by-email.service.tpl
@@ -24,3 +24,7 @@ TO: [% CONTACTEMAIL %]
 - Comment:     [% ACKCOMMENT %]
 [% END %]
 ----------------------------------
+[% IF NOTIFICATIONCOMMENT %]
+- Comment:     [% NOTIFICATIONCOMMENT %]
+----------------------------------
+[% END %]
diff --git a/packages/notifications-tt/skel/etc/nagios/conf.d/notification_commands.cfg b/packages/notifications-tt/skel/etc/nagios/conf.d/notification_commands.cfg
index 521e49e..955763c 100644
--- a/packages/notifications-tt/skel/etc/nagios/conf.d/notification_commands.cfg
+++ b/packages/notifications-tt/skel/etc/nagios/conf.d/notification_commands.cfg
@@ -7,6 +7,7 @@ define command {
 	command_line /usr/bin/perl $USER1$/notify-by-email.pl \
 		--template=$USER4$/etc/mail-templates/notify-by-email.host.tpl \
 		-o NOTIFICATIONTYPE='$NOTIFICATIONTYPE$' \
+		-o NOTIFICATIONCOMMENT='$NOTIFICATIONCOMMENT$' \
 		-o HOSTNAME='$HOSTNAME$' \
 		-o HOSTSTATE='$HOSTSTATE$' \
 		-o CONTACTEMAIL='$CONTACTEMAIL$' \
@@ -24,6 +25,7 @@ define command {
 	command_line /usr/bin/perl $USER1$/notify-by-email.pl \
 		--template=$USER4$/etc/mail-templates/notify-by-email.service.tpl  \
 		-o NOTIFICATIONTYPE='$NOTIFICATIONTYPE$' \
+		-o NOTIFICATIONCOMMENT='$NOTIFICATIONCOMMENT$' \
 		-o HOSTNAME='$HOSTNAME$' \
 		-o HOSTSTATE='$HOSTSTATE$' \
 		-o CONTACTEMAIL='$CONTACTEMAIL$' \



More information about the omd-commits mailing list