mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 21:50:47 +08:00
Add ZTE-first port traffic monitoring with task wizard and ops wall.
Collect interface bit/s via CLI on a schedule, store samples in Postgres, and chart trends with uPlot. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a95c6598bb
commit
efe8f58cd2
25 changed files with 2880 additions and 36 deletions
|
|
@ -27,6 +27,7 @@ from .db import Base, SessionLocal, engine, get_db
|
|||
from .collection_router import router as collection_router
|
||||
from .cli_router import router as cli_router
|
||||
from .config_sync_router import router as config_sync_router
|
||||
from .port_traffic_router import router as port_traffic_router
|
||||
from .managed_ne_router import router as managed_ne_router
|
||||
from .webcrt_router import router as webcrt_router
|
||||
from .topology_router import router as topology_router
|
||||
|
|
@ -135,6 +136,7 @@ app.include_router(managed_ne_router)
|
|||
app.include_router(cli_router)
|
||||
app.include_router(collection_router)
|
||||
app.include_router(config_sync_router)
|
||||
app.include_router(port_traffic_router)
|
||||
app.include_router(webcrt_router)
|
||||
app.include_router(topology_router)
|
||||
parser_cfg = load_parser_config()
|
||||
|
|
@ -836,11 +838,15 @@ def on_startup() -> None:
|
|||
_schedule_log.info("startup: resumed %s pending ne collection runs", resumed)
|
||||
from .config_sync_recovery import recover_config_sync_on_startup
|
||||
from .config_sync_service import ensure_policy
|
||||
from .port_traffic_recovery import recover_port_traffic_on_startup
|
||||
|
||||
ensure_policy(db)
|
||||
cfg_resumed = recover_config_sync_on_startup(db)
|
||||
if cfg_resumed:
|
||||
_schedule_log.info("startup: resumed %s config_sync task(s) from interrupted cycle", cfg_resumed)
|
||||
pt_cleared = recover_port_traffic_on_startup(db)
|
||||
if pt_cleared:
|
||||
_schedule_log.info("startup: cleared %s port_traffic stuck collect_running flag(s)", pt_cleared)
|
||||
except Exception:
|
||||
_schedule_log.exception("startup: ne collection / config_sync recovery failed")
|
||||
finally:
|
||||
|
|
@ -851,6 +857,12 @@ def on_startup() -> None:
|
|||
start_config_sync_scheduler()
|
||||
except Exception:
|
||||
_schedule_log.exception("startup: config_sync scheduler init failed")
|
||||
try:
|
||||
from .port_traffic_scheduler import start_port_traffic_scheduler
|
||||
|
||||
start_port_traffic_scheduler()
|
||||
except Exception:
|
||||
_schedule_log.exception("startup: port_traffic scheduler init failed")
|
||||
# Best-effort schema evolution for new columns (no migrations framework).
|
||||
# Safe for Postgres (IF NOT EXISTS); ignored on failure.
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue