简体   繁体   中英

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM