Pushover: Soundeinstellungen eingebunden

This commit is contained in:
Patrick 2020-07-20 22:04:57 +02:00
parent 75a6779bb2
commit 7ab0f58ec6
3 changed files with 41 additions and 1 deletions

View File

@ -47,6 +47,8 @@ object NotificationCommand "pushover-service-notification" {
HOSTNAME = "$host.name$"
SERVICENAME = "$service.name$"
SERVICEDISPLAYNAME = "$service.display_name$"
SERVICESTATE = "$service.state$"
HOSTDISPLAYNAME = "$host.display_name$"
SERVICESTATE = "$service.state$"
SERVICEOUTPUT = "$service.output$"

View File

@ -39,6 +39,10 @@ ICINGA2HOST="$(hostname)"
CURLPROXY=""
debug="0"
UP_SOUND="pushover"
DOWN_SOUND="siren"
UNREACHABLE_SOUND=""
#####################################################
#Übergebene Parameter
#
@ -100,6 +104,17 @@ then
PUSHOVEREXPIRE="300"
fi
#The hosts current state. Can be one of UNREACHABLE, UP and DOWN.
if [ "$HOSTSTATE" = "UP" ]
then
SOUND=$UP_SOUND
elif [ "$SERVICESTATE" = "DOWN" ]
then
SOUND=$DOWN_SOUND
elif [ "$SERVICESTATE" = "UNREACHABLE" ]
then
SOUND=$UNREACHABLE_SOUND
fi
#Kommando, um per curl die Pushover-message zu verschicken
failstate=$(curl \
@ -109,6 +124,7 @@ failstate=$(curl \
--form-string "user=$PUSHOVERUSER" \
--form-string "message=$PUSHOVERMESSAGE" \
--form-string "title=$PUSHOVERTITLE" \
--form-string "sound=$SOUND" \
--form-string "priority=$PUSHOVERPRIORITY" \
--form-string "retry=$PUSHOVERRETRY" \
--form-string "expire=$PUSHOVEREXPIRE" \

View File

@ -37,7 +37,12 @@
logpath="/var/log/pushover_icinga.txt"
ICINGA2HOST="$(hostname)"
CURLPROXY=""
debug="1"
debug="0"
OK_SOUND="pushover"
WARNING_SOUND="intermission"
CRITICAL_SOUND="siren"
UNKNOWN_SOUND=""
#####################################################
#Übergebene Parameter
@ -58,6 +63,8 @@ debug="1"
#
# HOSTNAME = "$host.name$"
# SERVICENAME = "$service.name$"
# SERVICEDISPLAYNAME = "$service.display_name$"
# SERVICESTATE = "$service.state$"
# HOSTDISPLAYNAME = "$host.display_name$"
# SERVICESTATE = "$service.state$"
# SERVICEOUTPUT = "$service.output$"
@ -102,6 +109,19 @@ then
PUSHOVEREXPIRE="300"
fi
#The services current state. Can be one of OK, WARNING, CRITICAL and UNKNOWN
if [ "$SERVICESTATE" = "OK" ]
then
SOUND=$OK_SOUND
elif [ "$SERVICESTATE" = "WARNING" ]
then
SOUND=$WARNING_SOUND
elif [ "$SERVICESTATE" = "CRITICAL" ]
then
SOUND=$CRITICAL_SOUND
else
SOUND=""
fi
#Kommando, um per curl die Pushover-message zu verschicken
failstate=$(curl \
@ -111,6 +131,7 @@ failstate=$(curl \
--form-string "user=$PUSHOVERUSER" \
--form-string "message=$PUSHOVERMESSAGE" \
--form-string "title=$PUSHOVERTITLE" \
--form-string "sound=$SOUND" \
--form-string "priority=$PUSHOVERPRIORITY" \
--form-string "retry=$PUSHOVERRETRY" \
--form-string "expire=$PUSHOVEREXPIRE" \
@ -140,6 +161,7 @@ NOTIFICATIONAUTHOR: $NOTIFICATIONAUTHOR
HOSTDISPLAYNAME: $HOSTDISPLAYNAME
SERVICEDISPLAYNAME: $SERVICEDISPLAYNAME
SERVICESTATE: $SERVICESTATE
SOUND: $SOUND
ICINGALONGDATETIME: $ICINGALONGDATETIME
ICINGA2HOST: $ICINGA2HOST
SERVICEOUTPUT: $SERVICEOUTPUT