diff --git a/homelab-ai-bot/monitor.py b/homelab-ai-bot/monitor.py index 8fd124f5..aaa2c982 100644 --- a/homelab-ai-bot/monitor.py +++ b/homelab-ai-bot/monitor.py @@ -52,11 +52,19 @@ def check_all() -> list[str]: errors = loki_client.get_errors(hours=0.5, limit=50) error_lines = [e for e in errors if "error" not in e] - panic_lines = [e for e in error_lines if - any(w in e.get("line", "").lower() for w in ["panic", "fatal", "oom", "out of memory"]) - and "query=" not in e.get("line", "") - and "caller=metrics" not in e.get("line", "") - ] + panic_lines = [] + for e in error_lines: + line = e.get("line", "") + ll = line.lower() + if not any(w in ll for w in ["panic", "fatal", "oom", "out of memory"]): + continue + if "query=" in line or "caller=metrics" in line: + continue + if "HTTP/1." in line and ('" 200 ' in line or '" 301 ' in line or '" 302 ' in line or '" 304 ' in line): + continue + if "GET /" in line or "POST /" in line or "HEAD /" in line: + continue + panic_lines.append(e) if panic_lines: hosts = set(e.get("host", "?") for e in panic_lines) hosts -= IGNORED_HOSTS