Skip to content

Question: how to export predictable identifier for systemd containers? #3748

@WilliamDEdwards

Description

@WilliamDEdwards

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions