summaryrefslogtreecommitdiffstats
path: root/src/health/notifications/alarm-notify.sh.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:35 +0000
commitf09848204fa5283d21ea43e262ee41aa578e1808 (patch)
treec62385d7adf209fa6a798635954d887f718fb3fb /src/health/notifications/alarm-notify.sh.in
parentReleasing debian version 1.46.3-2. (diff)
downloadnetdata-f09848204fa5283d21ea43e262ee41aa578e1808.tar.xz
netdata-f09848204fa5283d21ea43e262ee41aa578e1808.zip
Merging upstream version 1.47.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xsrc/health/notifications/alarm-notify.sh.in21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/health/notifications/alarm-notify.sh.in b/src/health/notifications/alarm-notify.sh.in
index 9a5780de1..c7c44cb11 100755
--- a/src/health/notifications/alarm-notify.sh.in
+++ b/src/health/notifications/alarm-notify.sh.in
@@ -641,8 +641,12 @@ filter_recipient_by_criticality() {
;;
CLEAR)
- # remove tracking file
- [ -f "${tracking_file}" ] && rm "${tracking_file}"
+ if [ -f "${tracking_file}" ]; then
+ tracking_file_existed="yes"
+ rm "${tracking_file}"
+ else
+ tracking_file_existed=""
+ fi
# "noclear" modifier set, block notification
if [ "${mod_noclear}" == "1" ]; then
@@ -657,7 +661,7 @@ filter_recipient_by_criticality() {
fi
# "critical" modifier set, send notification if tracking file exists
- if [ "${mod_critical}" == "1" ] && [ -f "${tracking_file}" ]; then
+ if [ "${mod_critical}" == "1" ] && [ -n "${tracking_file_existed}" ]; then
debug "SEVERITY FILTERING for ${recipient_arg} VIA ${method}: ALLOW: recipient has been notified for this alarm in the past (no status change will be sent from now)"
return 0
fi
@@ -1515,13 +1519,20 @@ send_telegram() {
notify_telegram=1
notify_retries=${TELEGRAM_RETRIES_ON_LIMIT:-0}
+ IFS=":" read -r chatID threadID <<< "${chatid}"
+
+ # https://core.telegram.org/bots/api#sendmessage
+ api_url="https://api.telegram.org/bot${bottoken}/sendMessage?chat_id=${chatID}"
+ if [ -n "${threadID}" ]; then
+ api_url+="&message_thread_id=${threadID}"
+ fi
+
while [ ${notify_telegram} -eq 1 ]; do
- # https://core.telegram.org/bots/api#sendmessage
httpcode=$(docurl ${disableNotification} \
--data-urlencode "parse_mode=HTML" \
--data-urlencode "disable_web_page_preview=true" \
--data-urlencode "text=${emoji} ${message}" \
- "https://api.telegram.org/bot${bottoken}/sendMessage?chat_id=${chatid}")
+ "${api_url}")
notify_telegram=0