Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Expose CPU Limit #8

Open
dechandler opened this issue Jun 16, 2020 · 0 comments
Open

Expose CPU Limit #8

dechandler opened this issue Jun 16, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@dechandler
Copy link

dechandler commented Jun 16, 2020

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!

@dechandler dechandler changed the title Expose host and container CPU counts Expose CPU Limit Jun 17, 2020
@sandersaares sandersaares added the enhancement New feature or request label Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants