Initial commit from Martins Github
This commit is contained in:
11
app/routers/alerts.py
Normal file
11
app/routers/alerts.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi import APIRouter
|
||||
from app.services import alertmanager
|
||||
|
||||
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}
|
||||
Reference in New Issue
Block a user