Initial commit from Martins Github
This commit is contained in:
12
app/routers/network.py
Normal file
12
app/routers/network.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from fastapi import APIRouter
|
||||
from app.services import prometheus
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/network/status")
|
||||
async def network_status():
|
||||
nfs = await prometheus.get_nf_status()
|
||||
up = sum(1 for n in nfs if n["state"] == "up")
|
||||
down = sum(1 for n in nfs if n["state"] == "down")
|
||||
return {"nfs": nfs, "summary": {"up": up, "down": down, "total": len(nfs)}}
|
||||
Reference in New Issue
Block a user