Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accurate CPU usage with Prometheus from WIndows

Using the wmi_exporter or the scollector_exporter with Prometheus I am finding it difficult to get accurate CPU usage. Here is the metrics I am using and the query I am using for scollector:

os_cpu with returns: 1.54432653e+07

I do a query with rate:

rate(os_cpu{exported_instance="myHost"}[30s])

Here is the graph I have come up with from this query in GrafanaGreen line is the utilisation

os_cpu returns a overall CPU usage i.e. all cores, and comparing this with Taskmanager in Windows it does not add up as that shows 100% max. It cannot be possible to get 300% CPU usage.

What can I do with my query to get a more accurate measurement?

like image 919
W Khan Avatar asked Mar 03 '26 16:03

W Khan


1 Answers

For now you might have found the answer, but anyway... This seems to be useful:

100 - (avg by (instance) (irate(windows_cpu_time_total{mode="idle", instance=~"$server"}[1m])) * 100)

from grafana dashboards library: https://grafana.com/grafana/dashboards/12566

enter image description here

like image 61
gypark Avatar answered Mar 06 '26 12:03

gypark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!