[omd-commits] OMD Git: omd: notification: extract ascii notifcation info if available

git version control git at mathias-kettner.de
Thu Jun 28 17:03:29 CEST 2012


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

Author:   Sven Nierlein <sven at consol.de>
Date:     Thu Jun 28 17:01:09 2012 +0200
Commiter: Sven Nierlein <sven at consol.de>
Date:     Thu Jun 28 17:01:09 2012 +0200

notification: extract ascii notifcation info if available

---

 packages/notifications-tt/notify-by-email.pl |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/packages/notifications-tt/notify-by-email.pl b/packages/notifications-tt/notify-by-email.pl
index b2bfb5a..a85e056 100755
--- a/packages/notifications-tt/notify-by-email.pl
+++ b/packages/notifications-tt/notify-by-email.pl
@@ -33,6 +33,9 @@ if ( ! -e $template ){
 	print "Template \"$template\" not found\n";
 	exit 3;
 }
+
+extract_ascii($macro{'LONGHOSTOUTPUT'});
+extract_ascii($macro{'LONGSERVICEOUTPUT'});
 process_template();
 exit;
 
@@ -64,3 +67,14 @@ $0 --template=<path to template> -o <MACRO>=<VALUE> -o ....
 
 ";
 }
+
+sub extract_ascii {
+    my($text) = @_;
+    return unless defined $text;
+    $text =~ s/.*
+               ^ASCII_NOTIFICATION_START$
+               \s*(.*)
+               ASCII_NOTIFICATION_END$
+               .*/$1/msx;
+    return;
+}



More information about the omd-commits mailing list