added multi node functionality
This commit is contained in:
BIN
app/routers/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/actions.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/actions.cpython-314.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/alerts.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/alerts.cpython-314.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/emulated_session.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/emulated_session.cpython-314.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/network.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/network.cpython-314.pyc
Normal file
Binary file not shown.
BIN
app/routers/__pycache__/query.cpython-314.pyc
Normal file
BIN
app/routers/__pycache__/query.cpython-314.pyc
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
from fastapi import APIRouter
|
||||
from app.services import alertmanager
|
||||
from app.services import alertmanager, cluster_inventory
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -8,4 +8,9 @@ router = APIRouter()
|
||||
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}
|
||||
return {
|
||||
"alerts": alerts,
|
||||
"total": len(alerts),
|
||||
"critical": critical,
|
||||
"cluster": await cluster_inventory.get_cluster_inventory(),
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
from fastapi import APIRouter
|
||||
from app.services import prometheus
|
||||
from app.services import cluster_inventory
|
||||
|
||||
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)}}
|
||||
return await cluster_inventory.get_network_status()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from fastapi import APIRouter
|
||||
from pydantic import BaseModel
|
||||
from app.services import prometheus, alertmanager, ai
|
||||
from app.services import cluster_inventory, alertmanager, ai
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -18,7 +18,7 @@ async def query(req: QueryRequest):
|
||||
|
||||
async def _gather(query_text: str):
|
||||
import asyncio
|
||||
nfs_task = asyncio.create_task(prometheus.get_nf_status())
|
||||
nfs_task = asyncio.create_task(cluster_inventory.get_network_status())
|
||||
alerts_task = asyncio.create_task(alertmanager.get_alerts())
|
||||
nfs, alerts = await asyncio.gather(nfs_task, alerts_task)
|
||||
return {"nfs": nfs}, alerts
|
||||
network_state, alerts = await asyncio.gather(nfs_task, alerts_task)
|
||||
return network_state, alerts
|
||||
|
||||
Reference in New Issue
Block a user