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

Expose CPU Limit #8

Open
Open
@dechandler

Description

@dechandler

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions