Prometheus metrics
The speaker offers its metrics to Prometheus on the home network: the web server, the board and the speaker itself, each under its own address. Grafana, or anything else that reads Prometheus, can then chart them.
They are off until the owner turns them on under Settings → System → Offer metrics to Prometheus; off, all three answer 404.
The three addresses
| Address | Source | What it contains |
|---|---|---|
http://boombox.local/metrics | Caddy / FrankenPHP | Requests, response times and status codes, the PHP workers |
http://boombox.local/metrics/system | node_exporter | CPU, memory, temperature, the microSD card, network, load |
http://boombox.local/metrics/speaker | the agent | What plays, Bluetooth, volume, playlists, recordings, Wi-Fi, display |
All three use the Prometheus text format (text/plain; version=0.0.4). boombox.local is the speaker's network name; use yours if you renamed it.
Scraping
scrape_configs:
- job_name: boombox-web
metrics_path: /metrics
static_configs: [{ targets: ['boombox.local'] }]
- job_name: boombox-system
metrics_path: /metrics/system
static_configs: [{ targets: ['boombox.local'] }]
- job_name: boombox-speaker
metrics_path: /metrics/speaker
static_configs: [{ targets: ['boombox.local'] }]If Prometheus runs in Docker and cannot resolve .local names, use the speaker's IP address instead.
Several speakers: list each one under every job.
static_configs: [{ targets: ['kitchen.local', 'garden.local', '192.168.1.40'] }]Grafana dashboard
boombox-grafana-dashboard.json is a starter dashboard for any number of speakers. Download it, then in Grafana go to Dashboards → New → Import, upload the file, and pick your Prometheus data source at the top of the dashboard.
| Row | What it shows |
|---|---|
| Overview | Speakers up, targets down, a table with one row per speaker (version, uptime, temperature, Wi-Fi, volume, what plays, phones, recording), and which targets answered over time |
| Playback | What plays per speaker, the volume and its limit, connected phones, and a timeline of amplifier, mute, headphones and recording |
| Health | Temperature (lines at 70 and 80 °C), Wi-Fi signal (red below 30 %), uptime, recordings waiting |
| Board | CPU, memory, the microSD card, network, load |
| Web | PHP requests by status, the 95th percentile response time, busy FrankenPHP workers |
Speaker at the top picks one speaker, several or all. The dashboard expects the job names above: boombox-speaker for the table's Agent column, and names starting with boombox for Targets down and Reachable. Keep them, or adjust those three queries.
It was made and tried with Grafana 11. Wi-Fi shows no data for a speaker on Ethernet or on its setup network: it has no signal to report.
The speaker's metrics
All are gauges. A part the speaker does not have, or has not reported yet, leaves its metrics out.
| Metric | Meaning |
|---|---|
boombox_up | 1: the agent answers |
boombox_info{hostname,agent,kernel,bluez} | Always 1; the labels name the speaker and its versions |
boombox_uptime_seconds | Seconds since the speaker started |
boombox_temperature_celsius | The system on a chip's temperature |
boombox_volume_percent | The volume |
boombox_volume_limit_percent | The volume limit that applies now (speakers or headphones) |
boombox_muted | 1: muted |
boombox_amplifier_on | 1: the amplifier is switched on |
boombox_listen_on_headphones | 1: listening on headphones or line out, the speakers off |
boombox_playing{source} | 1 per source that plays: bluetooth, playlist, stream |
boombox_bluetooth_devices{state} | Phones the speaker knows (paired) and those connected |
boombox_bluetooth_pairing_open | 1: new phones can pair |
boombox_playlists | Playlists on the speaker |
boombox_recording_enabled | 1: recording what phones play is on |
boombox_recording_active | 1: a song is being recorded |
boombox_recordings_pending | Recordings waiting to be stored |
boombox_recording_error | 1: the last recording could not be stored |
boombox_wifi_connected | 1: connected to a Wi-Fi network as a client (0 on the setup network) |
boombox_wifi_signal_percent | The Wi-Fi signal |
boombox_display_present | 1: the e-Paper display is set up |
boombox_knob_present | 1: the knob is set up |
Useful alerts: boombox_temperature_celsius > 80, boombox_recording_error == 1, boombox_wifi_signal_percent < 30, and up{job=~"boombox.*"} == 0 for a speaker that is gone.
Security
- The addresses answer private, loopback and link-local addresses only (10/8, 172.16/12, 192.168/16, fc00::/7 and the like), but not the setup network (10.42.0.0/24), whose guests are anyone near the speaker with its label. Anyone else gets
403. There is no password, as usual for Prometheus targets. - Caddy's own metrics listener (
127.0.0.1:9180) and node_exporter (127.0.0.1:9100) listen on the speaker itself only. The web app answers for them, so the rule above and the switch in Settings cover all three. - The metrics contain no song titles, phone names or network names: only numbers, the host name and versions.
| Answer | Meaning |
|---|---|
200 | The metrics |
403 | The request did not come from a private address |
404 | Metrics are off (the default): turn them on under Settings → System |
503 | The agent, Caddy's listener or node_exporter does not answer |
How it is built
| Part | Where |
|---|---|
| The three addresses, the address check, the switch | packages/boombox-speaker/Classes/Middleware/MetricsMiddleware.php |
| The speaker's metrics | packages/boombox-agent/src/Metrics/SpeakerMetrics.php, Service/MetricsService.php (op metrics.get, metrics.settings.set) |
Caddy's metrics on 127.0.0.1:9180 | deploy/device/files/Caddyfile.device (global metrics option and a :9180 site) |
node_exporter on 127.0.0.1:9100 | install.sh, step Metrics: the prometheus-node-exporter package and /etc/default/prometheus-node-exporter |
Development
DDEV runs the same setup: Caddy's metrics via CADDY_GLOBAL_OPTIONS and CADDY_EXTRA_CONFIG in .ddev/docker-compose.frankenphp_extra.yaml, node_exporter as a web daemon in .ddev/config.yaml.
curl -s https://boombox.ddev.site/metrics/speaker
ddev boombox-agent client metrics.settings.set '{"enabled":false}'The Playwright spec metrics.spec.ts checks all three addresses and the switch.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
403 from Prometheus | Prometheus reaches the speaker through a public address, a VPN or a proxy that is not in a private range. Scrape from inside the LAN. |
404 | Metrics are off: turn on Offer metrics to Prometheus under Settings → System. |
503 on /metrics/system | node_exporter is not running: systemctl status prometheus-node-exporter; run install.sh again to install it. |
503 on /metrics | The Caddyfile lacks the metrics option or the :9180 site (an edited shared/Caddyfile). Compare it with Caddyfile.device. |