Files
zabbix-gotify/gotify.sh
ladislav.dusa a1079d6806 build
2025-10-14 13:40:02 +02:00

45 lines
881 B
Bash

#!/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"