Skip to content

Commit

Permalink
Notification scripts: More readable & redundancy cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Gut authored and Michael Friedrich committed Aug 14, 2017
1 parent b4b3509 commit 0f0b6f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 4 additions & 5 deletions etc/icinga2/scripts/mail-host-notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
`

Expand Down Expand Up @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions etc/icinga2/scripts/mail-service-notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
`

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 0f0b6f1

Please sign in to comment.