Removed last remaining trace of last_alarm, only alert if it's new

This commit is contained in:
Trey Blancher 2023-08-25 18:06:02 -04:00
parent 427fb181d1
commit 7c6742a1b2

View File

@ -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,6 +295,7 @@ while true; do
continue continue
fi fi
last_line="${line}" last_line="${line}"
if (( time_diff < 3 )); then
local psi_type="$(grep -Eo "(CPU|MEM|IO) PSI event" <<< "${line}" | grep -Eo "CPU|MEM|IO")" local psi_type="$(grep -Eo "(CPU|MEM|IO) PSI event" <<< "${line}" | grep -Eo "CPU|MEM|IO")"
if [[ -n "${psi_type}" ]]; then if [[ -n "${psi_type}" ]]; then
secs+=(${psi_type} ${now}) secs+=(${psi_type} ${now})
@ -314,6 +314,7 @@ while true; do
fi fi
fi fi
fi fi
fi
sleep 1 sleep 1
done done
#set +x #set +x