7

I have configured Prometheus to scrape metrics from cAdvisor. However, the metric "container_cpu_load_average_10s" only returns 0. I am able to see the CPU metrics under the cAdvisor web UI correctly but Prometheus receives only 0. It is working fine for other metrics like "container_cpu_system_seconds_total". Could someone point if I am missing something here?

Prometheus version: 2.1.0

Prometheus config:

scrape_configs: - job_name: cadvisor scrape_interval: 5s metrics_path: /metrics scheme: http static_configs: - targets: - 172.17.0.2:8080

cAdvisor version: 0.29.0

aries
  • 849
  • 3
  • 11
  • 24

2 Answers2

9

In order to get the metric container_cpu_load_average_10s, the cAdvisor must run with the option

--enable_load_reader=true

which is set fo false by default. This is described here.

Pang
  • 9,564
  • 146
  • 81
  • 122
aries
  • 849
  • 3
  • 11
  • 24
  • it still doesn't work for me( entrypoint: /usr/bin/cadvisor -logtostderr -enable_load_reader=true – yuklia Nov 26 '18 at 11:19
  • 2
    Same, I'm getting errors like this: `W1128 07:45:13.721484 1 container.go:380] Could not initialize cpu load reader for "/docker": failed to create a netlink based cpuload reader: failed to get netlink family id for task stats: netlink request failed with error errno 0` – Wout Neirynck Nov 28 '18 at 07:55
  • 2
    have the same issue, found this: > the Task Stats netlink family (which cAdvisor uses to collect load stats) doesn't work within a network namespace. You'll need to either run your cAdvisor container in the host network (--net=host), or run outside of a container entirely. https://github.com/google/cadvisor/issues/1287 – ignivs Apr 29 '19 at 10:28
0

If the value is zero, it means the container is idle. You don't need 'enable_load_reader'. I don't enable it as it may make cAdvisor unstable. Some useful links:

Linux Load Averages: Solving the Mystery

High CPU utilization but low load average question

cAdvisor enable_load_reader

CodingFrog
  • 1,225
  • 2
  • 9
  • 17