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>
21 lines
776 B
Python
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]
|