From 141191bcdd4da0f7809f681b351427cd7511f003 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 8 Jul 2026 07:43:20 -0500 Subject: [PATCH] Fix jarvis-health.sh: watchdog-restart alerts never deduped or auto-resolved source_key was minute-stamped (health:wd_restart:YYYYMMDDHHMM), so the same restart event seen across two 5-min cron runs within the logs 6-min lookback window got two different keys -> two alert rows + two emails, and the key never matched a clear_cond call so these rows stayed resolved=0 forever, accumulating in the active-alerts view. Fixed to a stable key (health:wd_restart), matching the pattern used by the other three checks in this script: raise() now dedups via the existing COUNT..resolved=0 check, and clear_cond() runs when no recent restart line is found. Verified live: injected a fake watchdog restart log line, ran the script twice -> exactly 1 alert row + 1 email (not 2). Removed the line -> alert auto-resolved (resolved=1). Co-Authored-By: Claude Fable 5 --- deploy/jarvis-health.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/jarvis-health.sh b/deploy/jarvis-health.sh index 23922e3..620796a 100644 --- a/deploy/jarvis-health.sh +++ b/deploy/jarvis-health.sh @@ -64,7 +64,9 @@ if [ -f "$WDLOG" ]; then 'match($0,/^\[([0-9-]+ [0-9:]+)\]/,m){ if(m[1]>=cutoff && /restarted successfully/) print }' "$WDLOG") if [ -n "$RECENT" ]; then SVC=$(printf '%s' "$RECENT" | grep -oE '(nginx|php8.3-fpm|mariadb|redis-server)' | sort -u | tr '\n' ' ') - raise "health:wd_restart:$(date +%Y%m%d%H%M)" "warning" "Service auto-restarted" "Watchdog restarted: ${SVC:-a service}. Investigate why it died." + raise "health:wd_restart" "warning" "Service auto-restarted" "Watchdog restarted: ${SVC:-a service}. Investigate why it died." + else + clear_cond "health:wd_restart" fi fi