SparkBox's shipped "Containers" Grafana dashboard doesn't work — cAdvisor never exposes real container names
Posted by GipoidJr
The metrics module's cAdvisor (modules/metrics/docker-compose.yml) runs with zero command-line flags. Because of that, it discovers containers via raw containerd cgroups instead of talking to Docker's own API — so every cAdvisor metric's name label ends up being the raw containerd hex ID (f1a54c61015dff...), never the actual --name you gave the container. No com.docker.compose. labels come through either — the only extra label present on any metric is containerlabelcomdockerenginebundlepath, and that's just the same hex ID again. The shipped sparkbox-containers.json dashboard filters on name=~"sb-.", which can never match anything on a box configured this way — panels just come up empty, no error, nothing obviously "broken," just silently useless. The one label that does reliably work is image (e.g. lscr.io/linuxserver/prowlarr:2.4.0) — unique per service in the stack, so it's actually a fine substitute, just not what the dashboard uses. Two possible fixes: Rewrite the shipped dashboard's queries to group/filter on image instead of name (quick, matches what actually works today) Fix cAdvisor's config so it resolves real Docker container names (probably needs explicit docker socket flags) — better long-term, since it'd also make dashboards show sb-prowlarr instead of a raw image string, but I haven't verified the exact flags needed for cAdvisor v0.52.1 to do this reliably. Repro: curl 'http://localhost:9092/api/v1/query?query=containermemoryusagebytes{image!=""}' — check the name label on any result.
1 replies
Chris wrote:
Great write-up, GipoidJr — you nailed the root cause. Without host cgroup access, cAdvisor can only report the raw cgroup path instead of the real Docker container name, so the shipped dashboard's name=~"sb-.+" filter matches nothing. Tom's team already shipped a fix for exactly this in the latest release (v1.6.498): cAdvisor now runs with the host cgroup namespace, so the name label resolves correctly and the Containers dashboard should populate again. Run sudo sparkbox upgrade to pick it up, then give it a minute to start scraping fresh series. Let us know if panels are still empty after that.