Expose CPU Limit #8
Description
Feature Request: Metric to expose {{.HostConfig.NanoCpus}}
inspect property
The existing CPU panel in the example Grafana dashboard seems to compare container CPU usage to the full CPU capacity of the server, but my specific use-case is that I'm trying to calculate the percent CPU usage of the available capacity ({{.HostConfig.NanoCpus}}
from inspect, vs the host system CPU count).
The workaround I'm using just has the CPU count for a service's containers, but that's error-prone, and it throws off old data if I change the deployment.
Here's the query that I'm using currently. Please say if I'm misunderstanding something, but with the correct variables, it seems to accurately reflect CPU usage.
increase(docker_container_cpu_used_total{exported_name =~ "myapp[0-9]+"}[5m])
/ increase(docker_container_cpu_capacity_total[5m])
/ $myapp_cpus
* 100
* on (name) group_left count(netdata_cpu_cpu_percentage_average{job="myapp-netdata", dimension="user"}) by (name)
Having the host machine's CPU count would be a nice-to-have, but I'm currently getting that from Netdata and rolling it in, and I imagine that's pretty far outside the scope of what your existing code does.
I appreciate the exporter, I've found it very useful! Thanks!