Question: how to export predictable identifier for systemd containers?
- Dominant language
- Go
- Stars
- 19.4k
- Forks
- 2.5k
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 1
Description
# Situation:
cAdvisor collects stats for systemd-managed cgroups. Prometheus scrapes them. Given a unit, I want to collect metrics.
# Problem
For systemd containers, cAdvisor only exports the `id` (cgroup path). Here's an example metric:
container_cpu_load_d_average_10s{id="/system.slice/php-fpm-status-page-http-proxy.service"} 0 1762430495785
To find the cgroup path by systemd unit name, one can look at the `ControlGroup` property.
**However, this property is not accessible when the [systemd unit is not active](https://github.com/systemd/systemd/issues/38736).** In other words: when one has the systemd unit name, and wants to get exported cAdvisor metrics from Prometheus, that is _only_ possible when:
- Constructing the cgroup path manually (which is not foolproof at all)
- Getting the cgroup path from systemd, which is not possible when the systemd unit is inactive
# Question
Does cAdvisor provide primitives to export a predictable identifier for systemd containers?
As far as I can tell by reading the documentation and looking at the code, systemd is one of the few container plugins for which cAdvisor does **not** support container labels / environment variables.
Contributor guide
Assessment
This issue has not been assessed yet.