summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorJaphethLim <japheth.pub@gmail.com>2022-04-26 00:00:40 +1000
committerGitHub <noreply@github.com>2022-04-25 17:00:40 +0300
commit10e136e3c95f7f2184106a7f6b8c3638146ad49b (patch)
tree20c8e7a7804cbd8f8dbd1b45558f1a1f83368613 /health
parent7b7fbd6086207cf05a18fe1344833edfe03a8264 (diff)
Tag Gotify health notifications for the Gotify phone app (#12753)
Diffstat (limited to 'health')
-rwxr-xr-xhealth/notifications/alarm-notify.sh.in12
1 files changed, 10 insertions, 2 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in
index cfa5577b6e..8afe3a1dec 100755
--- a/health/notifications/alarm-notify.sh.in
+++ b/health/notifications/alarm-notify.sh.in
@@ -2292,7 +2292,7 @@ EOF
# Gotify sender
send_gotify() {
- local payload httpcode
+ local payload httpcode priority
[ "${SEND_GOTIFY}" != "YES" ] && return 1
if [ -z "${GOTIFY_APP_TOKEN}" ] ; then
@@ -2300,10 +2300,18 @@ send_gotify() {
return 1
fi
+ # priority for Gotify Android app
+ case "${status}" in
+ CRITICAL) priority=10 ;; # sound + vibration
+ WARNING) priority=4 ;; # sound
+ *) priority=1 ;; # notification only
+ esac
+
payload=$(cat <<EOF
{
"title" : "${status}, ${name} = ${value_string}, on ${host}",
- "message" : "${date}: ${chart} ${value_string}"
+ "message" : "${date}: ${chart} ${value_string}",
+ "priority" : ${priority}
}
EOF
)