Files
p5g-marvis/app/routers/alerts.py
2026-04-24 12:33:52 -04:00

17 lines
449 B
Python

from fastapi import APIRouter
from app.services import alertmanager, cluster_inventory
router = APIRouter()
@router.get("/alerts")
async def get_alerts():
alerts = await alertmanager.get_alerts()
critical = sum(1 for a in alerts if a.get("severity") == "critical")
return {
"alerts": alerts,
"total": len(alerts),
"critical": critical,
"cluster": await cluster_inventory.get_cluster_inventory(),
}