Removed last remaining trace of last_alarm, only alert if it's new
This commit is contained in:
parent
427fb181d1
commit
7c6742a1b2
@ -282,7 +282,6 @@ while true; do
|
|||||||
integer elapsed=$(( now - ${secs[${alarm}]} ))
|
integer elapsed=$(( now - ${secs[${alarm}]} ))
|
||||||
if is_clear "${alarm}" && (( elapsed >= 300 )); then
|
if is_clear "${alarm}" && (( elapsed >= 300 )); then
|
||||||
current_alarms=$(sed -E "s/${alarm}\|?//" <<< "${current_alarms}")
|
current_alarms=$(sed -E "s/${alarm}\|?//" <<< "${current_alarms}")
|
||||||
last_alarm=$(awk -F'|' '{print $NF}' <<< "${current_alarms}")
|
|
||||||
unset "notice_sent[${alarm}]"
|
unset "notice_sent[${alarm}]"
|
||||||
unset "secs[${alarm}]"
|
unset "secs[${alarm}]"
|
||||||
fi
|
fi
|
||||||
@ -296,21 +295,23 @@ while true; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
last_line="${line}"
|
last_line="${line}"
|
||||||
local psi_type="$(grep -Eo "(CPU|MEM|IO) PSI event" <<< "${line}" | grep -Eo "CPU|MEM|IO")"
|
if (( time_diff < 3 )); then
|
||||||
if [[ -n "${psi_type}" ]]; then
|
local psi_type="$(grep -Eo "(CPU|MEM|IO) PSI event" <<< "${line}" | grep -Eo "CPU|MEM|IO")"
|
||||||
secs+=(${psi_type} ${now})
|
if [[ -n "${psi_type}" ]]; then
|
||||||
if [[ ! ${notice_sent[${psi_type}]} ]]; then
|
secs+=(${psi_type} ${now})
|
||||||
last_dunst_id=$(exec_notices "${psi_type}" "${current_alarms}")
|
if [[ ! ${notice_sent[${psi_type}]} ]]; then
|
||||||
notice_sent+=(${psi_type} true)
|
last_dunst_id=$(exec_notices "${psi_type}" "${current_alarms}")
|
||||||
elif (( last_dunst_id >= 0 )) && check_dunst_id_is_visible "${last_dunst_id}"; then
|
notice_sent+=(${psi_type} true)
|
||||||
sleep 1
|
elif (( last_dunst_id >= 0 )) && check_dunst_id_is_visible "${last_dunst_id}"; then
|
||||||
continue
|
sleep 1
|
||||||
fi
|
continue
|
||||||
if [[ -z "${current_alarms}" ]]; then
|
fi
|
||||||
current_alarms="${psi_type}"
|
if [[ -z "${current_alarms}" ]]; then
|
||||||
else
|
current_alarms="${psi_type}"
|
||||||
if ! grep -q "${psi_type}" <<< "${current_alarms}"; then
|
else
|
||||||
current_alarms="${current_alarms}|${psi_type}"
|
if ! grep -q "${psi_type}" <<< "${current_alarms}"; then
|
||||||
|
current_alarms="${current_alarms}|${psi_type}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user