google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
16.97k stars 2.31k forks source link

Requesting Clarification about CPU Usage #2182

Closed DevinCampbell closed 5 years ago

DevinCampbell commented 5 years ago

I am attempting to set up a graph in Grafana showing total CPU usage by container over time. I currently have InfluxDB, cAdvisor, and Grafana all running in Docker containers. When I look in cAdvisor's web GUI the y-axis shows "Cores" but when I go into Grafana and choose the metric "cpu_usage_total" it is showing significantly larger numbers, so there must be something I'm not understanding here about how CPU usage is measured by cAdvisor. I have attempted to look in the documentation in google/cadvisor/docs but I'm not seeing an explanation for this.

dashpole commented 5 years ago

In the influxdb storage plugin, it sends "cpu_usage_total" as the value of stats.CPU.Usage.Total, which is in nanoseconds according to the v1 api

DevinCampbell commented 5 years ago

Ok, so stats.CPU.Usage.Total measures CPU usage by the amount of time in nanoseconds each container utilizes the CPU?

dashpole commented 5 years ago

yeah, it is a cumulative metric, so it is the total number of nanosecond-cores a container has utilized since its creation.