From a1079d6806d737721bce12f28d698e2a1a46e103 Mon Sep 17 00:00:00 2001 From: "ladislav.dusa" Date: Tue, 14 Oct 2025 13:40:02 +0200 Subject: [PATCH] build --- gotify.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gotify.sh diff --git a/gotify.sh b/gotify.sh new file mode 100644 index 0000000..07a5bf9 --- /dev/null +++ b/gotify.sh @@ -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" \ No newline at end of file