Tag Gotify health notifications for the Gotify phone app (#12753)
JaphethLim committed
Apr 26, 2022 at 00:00 UTC
10e136e3c95f7f2184106a7f6b8c3638146ad49b
1 file changed
+10
-2
health/notifications/alarm-notify.sh.in
+10
-2
@@ -2292,7 +2292,7 @@ EOF
2292
# Gotify sender
2293
2294
send_gotify() {
2295
- local payload httpcode
2295
+ local payload httpcode priority
2296
[ "${SEND_GOTIFY}" != "YES" ] && return 1
2297
2298
if [ -z "${GOTIFY_APP_TOKEN}" ] ; then
@@ -2300,10 +2300,18 @@ send_gotify() {
2300
return 1
2301
fi
2302
2303
+ # priority for Gotify Android app
2304
+ case "${status}" in
2305
+ CRITICAL) priority=10 ;; # sound + vibration
2306
+ WARNING) priority=4 ;; # sound
2307
+ *) priority=1 ;; # notification only
2308
+ esac
2309
+
2310
payload=$(cat <<EOF
2311
{
2312
"title" : "${status}, ${name} = ${value_string}, on ${host}",
2306
- "message" : "${date}: ${chart} ${value_string}"
2313
+ "message" : "${date}: ${chart} ${value_string}",
2314
+ "priority" : ${priority}
2315
}
2316
EOF
2317
)