add diagnostic dashboard served from prometheus-exporter

- dashboard.html: standalone HTML, fetches :9090/metrics, auto-refresh
- Exporter serves dashboard at /dashboard and /dashboard.html
- Cards: Pipeline, Audio, Mixer, MIDI Bridge, LED Viz
- Live gauges, counters, service status dots, last-activity timestamps
This commit is contained in:
2026-06-24 02:43:31 -07:00
parent 74e0d3fa03
commit 2e10839fc9
2 changed files with 404 additions and 0 deletions
+16
View File
@@ -236,6 +236,9 @@ def format_metrics():
return "\n".join(lines) + "\n"
DASHBOARD_PATH = os.path.join(os.path.dirname(__file__), "dashboard.html")
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/metrics":
@@ -252,6 +255,18 @@ class Handler(http.server.BaseHTTPRequestHandler):
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(body)
elif self.path in ("/dashboard", "/dashboard.html"):
try:
with open(DASHBOARD_PATH) as f:
body = f.read().encode()
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
except OSError:
self.send_response(404)
self.end_headers()
else:
self.send_response(404)
self.end_headers()
@@ -268,6 +283,7 @@ def main():
t.start()
server = http.server.HTTPServer(("0.0.0.0", PORT), Handler)
print(f"[metrics] Listening on :{PORT}/metrics")
print(f"[metrics] Dashboard: http://0.0.0.0:{PORT}/dashboard")
server.serve_forever()