A lightweight, real-time web dashboard for monitoring CPU, Memory, and NPU usage on RK3566-based boards (e.g. Orange Pi CM4).
Metrics are polled at a configurable interval, persisted to a local JSON file, exposed via a Prometheus /metrics endpoint, and displayed in an interactive dark-themed web UI with Chart.js time-series charts.
- Real-time dashboard – live CPU, Memory, and NPU gauges with progress bars, auto-refreshed every poll interval
- Interactive time-series charts – combined and per-metric Chart.js line graphs with pan, scroll-zoom, and time-window presets (15 m / 1 h / 6 h / 24 h / All)
- NPU support – reads
NPU loadfrom the RK3566 sysfs entry (/sys/kernel/debug/rknpu/load); gracefully degrades when unavailable - Data persistence – metrics are written to a JSON file and reloaded on restart; no external database required
- Configurable retention – raw data kept for a configurable window (default 24 h), then automatically downsampled into 1-hour averages; total history pruned after a configurable number of days (default 14)
- Prometheus endpoint –
/metricsexposessystem_cpu_percent,system_memory_percent, andsystem_npu_percentgauges for scraping - REST API –
/api/data(full history),/api/current(latest sample), and/api/config(runtime settings) - Docker-ready – single-command deployment via Docker Compose
# Clone the repository
git clone https://github.com/masterlog80/test-copilot.git
cd test-copilot
# Build and start
docker compose up -d
# Open the dashboard
open http://localhost:5001Note: The container runs with
privileged: trueto access/sys/kernel/debug/rknpu/loadfor NPU readings.
You can remove that flag on non-RK3566 hardware — CPU and Memory monitoring will still work.
docker build -t rk3566-monitor .
docker run -d \
--name rk3566-monitor \
--privileged \
-p 5001:5001 \
-v monitor-data:/data \
rk3566-monitor# Python 3.12+ required
pip install -r requirements.txt
# Start the development server
DATA_FILE=/tmp/metrics.json python app.py
# → http://localhost:5001| Variable | Default | Description |
|---|---|---|
POLL_INTERVAL |
10 |
Seconds between metric samples |
STORE_TIMEFRAME_DAYS |
14 |
Days of data to retain before pruning |
DOWNSAMPLE_HOURS |
24 |
Hours of raw-resolution data to keep; older data is averaged into 1-h buckets |
DATA_FILE |
/data/metrics.json |
Path to the persistent JSON metrics file |
NPU_LOAD_PATH |
/sys/kernel/debug/rknpu/load |
sysfs path for NPU load (RK3566 only) |
PORT |
5001 |
HTTP port the server listens on |
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Web dashboard (HTML) |
/api/current |
GET | Latest metric sample as JSON |
/api/data |
GET | Full stored history as JSON array |
/api/config |
GET | Active runtime configuration |
/metrics |
GET | Prometheus text-format metrics |
{
"ts": "2025-01-15T12:34:56.789+00:00",
"cpu": 43.2,
"mem": 61.8,
"npu": 28.5,
"npu_available": true
}.
├── app.py # Flask application – polling, persistence, REST API, Prometheus
├── templates/
│ └── index.html # Dark-themed dashboard (Bootstrap 5 + Chart.js)
├── static/
│ └── favicon.svg # SVG chip icon
├── requirements.txt # Python dependencies
├── Dockerfile # Production image (gunicorn, non-root user)
└── docker-compose.yml # Compose stack with volume for persistence
| Feature | RK3566 / Orange Pi CM4 | Other Linux (x86, RPi, …) |
|---|---|---|
| CPU monitoring | ✅ | ✅ |
| Memory monitoring | ✅ | ✅ |
| NPU monitoring | ✅ | ❌ (shown as N/A) |
MIT
