From 0f0b6f1df9576ff2bc6620dd603452fa6ad3a85e Mon Sep 17 00:00:00 2001 From: Christian Gut Date: Mon, 7 Aug 2017 15:55:17 +0200 Subject: [PATCH] Notification scripts: More readable & redundancy cleanup --- etc/icinga2/scripts/mail-host-notification.sh | 9 ++++----- etc/icinga2/scripts/mail-service-notification.sh | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/etc/icinga2/scripts/mail-host-notification.sh b/etc/icinga2/scripts/mail-host-notification.sh index 1f5db94db04..38520febfbd 100755 --- a/etc/icinga2/scripts/mail-host-notification.sh +++ b/etc/icinga2/scripts/mail-host-notification.sh @@ -93,14 +93,14 @@ SUBJECT="[$NOTIFICATIONTYPE] Host $HOSTDISPLAYNAME is $HOSTSTATE!" ## Build the notification message NOTIFICATION_MESSAGE=`cat << EOF -***** Icinga 2 Host Monitoring on $HOSTNAME ***** +***** Host Monitoring on $HOSTNAME ***** -==> $HOSTDISPLAYNAME ($HOSTNAME) is $HOSTSTATE! <== +$HOSTDISPLAYNAME is $HOSTSTATE! Info: $HOSTOUTPUT When: $LONGDATETIME -Host: $HOSTNAME (Display Name: "$HOSTDISPLAYNAME") +Host: $HOSTNAME EOF ` @@ -128,8 +128,7 @@ fi if [ -n "$ICINGAWEB2URL" ] ; then NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE -URL: - $ICINGAWEB2URL/monitoring/host/show?host=$HOSTNAME" +$ICINGAWEB2URL/monitoring/host/show?host=$HOSTNAME" fi ## Check whether verbose mode was enabled and log to syslog. diff --git a/etc/icinga2/scripts/mail-service-notification.sh b/etc/icinga2/scripts/mail-service-notification.sh index f99e3ed1840..7fc1b2630ac 100755 --- a/etc/icinga2/scripts/mail-service-notification.sh +++ b/etc/icinga2/scripts/mail-service-notification.sh @@ -98,15 +98,15 @@ SUBJECT="[$NOTIFICATIONTYPE] $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICE ## Build the notification message NOTIFICATION_MESSAGE=`cat << EOF -***** Icinga 2 Service Monitoring on $HOSTNAME ***** +***** Service Monitoring on $HOSTNAME ***** -==> $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE! <== +$SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE! Info: $SERVICEOUTPUT When: $LONGDATETIME -Service: $SERVICENAME (Display Name: "$SERVICEDISPLAYNAME") -Host: $HOSTNAME (Display Name: "$HOSTDISPLAYNAME") +Service: $SERVICENAME +Host: $HOSTNAME EOF ` @@ -134,8 +134,7 @@ fi if [ -n "$ICINGAWEB2URL" ] ; then NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE -URL: - $ICINGAWEB2URL/monitoring/service/show?host=$HOSTNAME&service=$SERVICENAME" +$ICINGAWEB2URL/monitoring/service/show?host=$HOSTNAME&service=$SERVICENAME" fi ## Check whether verbose mode was enabled and log to syslog.