Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I graph cpu usage in grafana using Prometheus and the collectd exporter?

New to promql and I'm trying to graph cpu usage over time and I've found the following example getting a static percent of usage but how would I convert it to a rate for grafana?

100 * (1 - sum(collectd_cpu_total{type="idle"}) by (exported_instance) / sum(collectd_cpu_total) by (exported_instance))

I got this example from https://github.com/Naugrimm/promql-examples

like image 420
Drew Pierce Avatar asked Sep 07 '25 11:09

Drew Pierce


1 Answers

Since you are using Prometheus already, why don't you use Prometheus' node_exporter? https://www.robustperception.io/understanding-machine-cpu-usage

100 - (avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100)
like image 87
Hang Avatar answered Sep 11 '25 00:09

Hang