This commit is contained in:
ladislav.dusa
2025-10-14 13:40:02 +02:00
parent e01519a457
commit a1079d6806

45
gotify.sh Normal file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
echo "checking curl package"
if [[ `apk info -vv | egrep '^curl'` ]]
then
echo "Package ok"
else
echo "Installing..."
apk add curl
fi
# Gotify-Server URL (IP or FQDN)
GOTIFY_URL="https://gotify.sectorq.eu"
# Zabbix Parameter
GOTIFY_TOKEN=$1
SUBJECT=$2
MESSAGE=$3
SEVERITY=$4
# Converting Zabbix issue level to Gotify priority
case $SEVERITY in
"Disaster")
PRIORITY=10
;;
"High")
PRIORITY=8
;;
"Average")
PRIORITY=5
;;
"Warning")
PRIORITY=3
;;
"Information")
PRIORITY=0
;;
"Not classified")
PRIORITY=0
;;
*)
PRIORITY=1 # Default value for undefined severity
;;
esac
# Sending the message to Gotify
curl -X POST "$GOTIFY_URL/message?token=$GOTIFY_TOKEN" -F "title=$SUBJECT" -F "message=$MESSAGE" -F "priority=$PRIORITY"