0
votes

why I use node_exporter to get cpu utilization is a negative number? My query info is "round((1 - avg(irate(node_cpu_seconds_total{mode="idle"}[5m])))*100,0.01)"

1

1 Answers

0
votes

I am not getting a negative number on executing your expression.

But I think if you want the CPU Usage of the system then I would use this query. I'm a total beginner in PromQL and I am sure there is a more effective way but this works for me:

(1-rate(node_cpu_seconds_total{job="node_exporter",mode="idle"}[1m]))*100

Expresses (1% for both CPUs):

{cpu="0",instance="localhost:9100",job="node_exporter",mode="idle"} 1.056344430236733 {cpu="1",instance="localhost:9100",job="node_exporter",mode="idle"} 1.6381520334300625