fix sending CLEAR notifications with critical severity modifier (#18347)
Ilya Mashchenko committed
Aug 16, 2024 at 14:40 UTC
c7c9ec0362065d7084d657e35bc55b1c0c76b132
1 file changed
+7
-3
src/health/notifications/alarm-notify.sh.in
+7
-3
@@ -641,8 +641,12 @@ filter_recipient_by_criticality() {
641
;;
642
643
CLEAR)
644
- # remove tracking file
645
- [ -f "${tracking_file}" ] && rm "${tracking_file}"
644
+ if [ -f "${tracking_file}" ]; then
645
+ tracking_file_existed="yes"
646
+ rm "${tracking_file}"
647
+ else
648
+ tracking_file_existed=""
649
+ fi
650
651
# "noclear" modifier set, block notification
652
if [ "${mod_noclear}" == "1" ]; then
@@ -657,7 +661,7 @@ filter_recipient_by_criticality() {
661
fi
662
663
# "critical" modifier set, send notification if tracking file exists
660
- if [ "${mod_critical}" == "1" ] && [ -f "${tracking_file}" ]; then
664
+ if [ "${mod_critical}" == "1" ] && [ -n "${tracking_file_existed}" ]; then
665
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)"
666
return 0
667
fi