feat: add system metrics dashboard with resource monitoring

- Add system metrics endpoint (CPU load, memory, swap, network traffic)
- Collect metrics from /proc and /sys (no subprocess required)
- Overhaul dashboard to pull from per-subsystem models
- Remove deprecated /status/all monolithic endpoint
- Improve networkd import to handle optional priority prefix
- Fix CSS duplicate .grid-4 rule and unused dashboard imports
This commit is contained in:
2026-07-15 00:24:43 +00:00
parent c21639b7f1
commit dadabd7954
11 changed files with 438 additions and 107 deletions
-23
View File
@@ -17,8 +17,6 @@ from pathlib import Path
from flask import Flask, abort, request
from werkzeug.middleware.proxy_fix import ProxyFix
from daemon.client import get
from daemon.iface import GET_STATUS_ALL
from lib.logging import setup_logging
from webui.api.certs import bp as certs_bp
from webui.api.dhcp import bp as dhcp_bp
@@ -158,27 +156,6 @@ def _log_request_finish(response):
return response
# ---------------------------------------------------------------------------
# API proxy routes
# ---------------------------------------------------------------------------
@app.route("/api/status/all")
def api_status_all():
"""Return aggregated status from all subsystems.
Proxies the daemon's ``/status/all`` endpoint for SPA consumption.
Returns:
JSON response with state data for all subsystems.
"""
try:
return {"ok": True, "data": get(GET_STATUS_ALL)}
except Exception as exc:
logger.warning("Status all failed: %s", exc)
return {"ok": False, "error": str(exc)}, 500
# ---------------------------------------------------------------------------
# SPA entry point — serve index.html for /, 404 for everything else
# ---------------------------------------------------------------------------