mirror of
https://gitlab.sectorq.eu/jaydee/zabbix-gotify.git
synced 2025-12-14 02:34:53 +01:00
build
This commit is contained in:
45
gotify.sh
Normal file
45
gotify.sh
Normal 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"
|
||||||
Reference in New Issue
Block a user