How aihades/metrics-raspberry-api works
This is a Linux system-metrics dashboard. A browser loads the metrics page, opens a WebSocket, and receives periodic temperature, battery, memory, and disk readings that the frontend displays. The backend gathers readings through psutil, packages them in a schema, and serves the page and static assets. The tree and sampled source support this main workflow; no README was provided, and unsampled details are omitted.
Main entry points: metrics_router.py Metrics routes · main.py FastAPI app · metrics.py Metrics collector · mainpage.js Dashboard behavior
Components 10
Browser UI
- Dashboard template
frontend/templates/index.html - Dashboard behavior
frontend/static/js/mainpage.js - Dashboard styles
frontend/static/css/mainpage.css
Web API
- FastAPI app
backend/main.py - Metrics routes
backend/api/routers/metrics_router.py - Frontend paths
backend/src/config.py - Metrics schema
backend/src/schemas/metrics.py
Metric Collection
- Metrics collector
backend/metrics.py
Other components
- Browser
- psutil system readings
Connections 17
- FastAPI app → Metrics routes: registers routes
- Browser → FastAPI app: requests root
- FastAPI app → Browser: redirects to metrics
- Browser → Metrics routes: requests page
- Metrics routes → Frontend paths: reads paths
- Metrics routes → Dashboard template: renders page
- Metrics routes → Browser: serves page
- Browser → Metrics routes: opens WebSocket
- Metrics routes → Metrics collector: reads metrics
- Metrics collector → psutil system readings: queries system
- Metrics collector → Metrics routes: returns readings
- Metrics routes → Metrics schema: builds payload
- Metrics routes → Browser: sends JSON
- Browser → Dashboard behavior: runs script
- Dashboard behavior → Browser: updates display
- Metrics routes → Dashboard behavior: serves static asset
- Metrics routes → Dashboard styles: serves static asset