Use Emoji to represent SERVICESTATE

This commit is contained in:
Jonny007-MKD 2020-10-19 20:07:22 +02:00
parent 807f709a02
commit 5c6e1b560c

View file

@ -90,14 +90,18 @@ do
esac
done
## Build the message's subject
SUBJECT="[$NOTIFICATIONTYPE] $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE!"
case "$SERVICESTATE" in
CRITICAL) SERVICESTATEICON=$'\xF0\x9F\x9F\xA5';;
WARNING) SERVICESTATEICON=$'\xF0\x9F\x9F\xA7';;
OK) SERVICESTATEICON=$'\xF0\x9F\x9F\xA9';;
*) SERVICESTATEICON="[$SERVICESTATE]";;
esac
## Build the message itself
NOTIFICATION_MESSAGE=$(cat << EOF
[$SERVICESTATE] $SERVICEDISPLAYNAME is $SERVICESTATE since $LONGDATETIME
Host: $HOSTALIAS (IPv4 $HOSTADDRESS)
More info: $SERVICEOUTPUT
$SERVICESTATEICON <b>$SERVICEDISPLAYNAME</b> is ${SERVICESTATE} since $LONGDATETIME
Host: <b>$HOSTALIAS</b> (IPv4 $HOSTADDRESS)
EOF
)
@ -107,6 +111,9 @@ if [ -n "$HOSTADDRESS6" ] ; then
IPv6? $HOSTADDRESS6"
fi
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
More info: $SERVICEOUTPUT"
## Are there any comments? Put them into the message!
if [ -n "$NOTIFICATIONCOMMENT" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
@ -118,12 +125,13 @@ fi
## Are we using Icinga Web 2? Put the URL into the message!
if [ -n "$HAS_ICINGAWEB2" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
Get live status:
$HAS_ICINGAWEB2/monitoring/host/show?host=$HOSTALIAS"
<a href='$HAS_ICINGAWEB2/monitoring/host/show?host=$HOSTALIAS'>Icinga Web</a>"
fi
## Are we verbose? Then put a message to syslog...
if [ "$VERBOSE" == "true" ] ; then
SUBJECT="[$NOTIFICATIONTYPE] $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE!"
logger "$PROG sends $SUBJECT => Telegram Channel $TELEGRAM_BOT"
fi