-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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. 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.