Files
checkbot/app/web/problem_status.py
patrickandClaude Sonnet 5.5 347f55cf7c
test / pytest (3.11) (push) Waiting to run
test / pytest (3.13) (push) Waiting to run
feat: Phase 6c baseline, ack, host alarms, outage notice, send limit, privacy mode, UI link
Includes atomic migrations, per-rule reminder semantics, first-run helper script
and the note on the undecided UI chat idea.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 03:06:23 +01:00

21 lines
776 B
Python

import time
from fastapi import Request
from ..alerts import report_status
from ..models import HOST_SERVICE_NAME
from ..poller.options import read_default_delay, read_host_delay
def problems_with_status(request: Request) -> list[dict]:
runtime = request.app.state.runtime
now = time.time()
rules = runtime.routes.enabled_routes()
mutes = runtime.mutes.active(now)
store = request.app.state.store
default_minutes, host_minutes = read_default_delay(store), read_host_delay(store)
rows = runtime.alerts.open_problems()
down_hosts = {row["host"] for row in rows if row["service"] == HOST_SERVICE_NAME}
return [{**row, "report": report_status(row, rules, mutes, default_minutes, now, host_minutes, down_hosts)}
for row in rows]