Fix services-check to show all firing alerts per alert name
check_alert() used head -1 to display only the first firing instance, silently swallowing additional alerts (e.g. frigate pod-not-ready was hidden behind ollama). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a75f28e073
commit
b08b1a833f
2 changed files with 11 additions and 9 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
Fix services-check to display all firing alerts for a given alert name, not just the first one.
|
||||||
|
|
@ -100,16 +100,17 @@ for a in alerts:
|
||||||
if [ -z "$firing" ]; then
|
if [ -z "$firing" ]; then
|
||||||
echo -e "${GREEN}OK${NC}"
|
echo -e "${GREEN}OK${NC}"
|
||||||
else
|
else
|
||||||
local summary runbook
|
|
||||||
summary=$(echo "$firing" | head -1 | cut -d'|' -f1)
|
|
||||||
runbook=$(echo "$firing" | head -1 | cut -d'|' -f2)
|
|
||||||
echo -e "${RED}FIRING${NC}"
|
echo -e "${RED}FIRING${NC}"
|
||||||
|
local runbook_printed=false
|
||||||
|
while IFS='|' read -r summary runbook; do
|
||||||
if [ -n "$summary" ]; then
|
if [ -n "$summary" ]; then
|
||||||
echo -e " $summary"
|
echo -e " $summary"
|
||||||
fi
|
fi
|
||||||
if [ -n "$runbook" ]; then
|
if [ -n "$runbook" ] && [ "$runbook_printed" = false ]; then
|
||||||
echo -e " Runbook: $runbook"
|
echo -e " Runbook: $runbook"
|
||||||
|
runbook_printed=true
|
||||||
fi
|
fi
|
||||||
|
done <<< "$firing"
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue