Verifying CPU percentage

  • What Grafana version and what operating system are you using?

I’m using grafana version v9.0.2, linux rhel 7.9, and prometheus is my datasource

  • What are you trying to achieve?

I’m trying to calculate the CPU utilization of every instance as percentages.

  • How are you trying to achieve it?

I’m using this sum by (instance)(rate(node_cpu_seconds_total{mode!="idle"}[$__rate_interval])) * 100 calculation but the terms confuse me, so I’m uncertain that the calculation is correct.

I’ve also used the following one
100 - (avg by (instance)(irate(node_cpu_seconds_total{mode="idle"}[$__rate_interval])) * 100)

I guess this one calculates the total percentage of idleness and subtracts it from the whole.

  • What happened?
    They both look correct but I’m uncertain how to verify the correctness of the calculations.

  • Did you follow any online instructions? If so, what is the URL?

If found something on stackoverflow

And on this board, where the calculation is shown in the json object that vunh1 posted.

Thanks! :slight_smile: