Added icon to host notifications

This commit is contained in:
Jonny007-MKD 2020-10-19 21:21:39 +02:00
parent 6d601ac73a
commit e974f45990
2 changed files with 14 additions and 1 deletions

View file

@ -88,6 +88,15 @@ do
done
# make icon out of service state
case "$HOSTSTATE" in
UP) HOSTSTATEICON=$'\xF0\x9F\x9F\xA9 ';;
DOWN) HOSTSTATEICON=$'\xF0\x9F\x9F\xA5 ';;
UNKNOWN) HOSTSTATEICON=$'\xE2\x9D\x93\x0A ';;
*) HOSTSTATEICON="";;
esac
# convert date
dateInSec=$(date -d "$LONGDATETIME" +%s)
nowInSec=$(date +%s)
@ -120,7 +129,7 @@ fi
## Build the message itself
NOTIFICATION_MESSAGE=$(cat << EOF
<b>$HOSTDISPLAYNAME</b>$HOSTALIAS2 is $HOSTSTATE!
$HOSTSTATEICON<b>$HOSTDISPLAYNAME</b>$HOSTALIAS2 is $HOSTSTATE!
Since $age
Info $HOSTOUTPUT
IPv4 $HOSTADDRESS

View file

@ -90,13 +90,17 @@ do
esac
done
# make icon out of service state
case "$SERVICESTATE" in
CRITICAL) SERVICESTATEICON=$'\xF0\x9F\x9F\xA5';;
WARNING) SERVICESTATEICON=$'\xF0\x9F\x9F\xA7';;
OK) SERVICESTATEICON=$'\xF0\x9F\x9F\xA9';;
UNKNOWN) SERVICESTATEICON=$'\xE2\x9D\x93\x0A';;
*) SERVICESTATEICON="[$SERVICESTATE]";;
esac
# convert date
dateInSec=$(date -d "$LONGDATETIME" +%s)
nowInSec=$(date +%s)