CPU usage query

Hi,
I am retying to create a dashboard for the CPU usage.
I created one like the following:
sum by(mode)(irate(node_cpu_seconds_total{instance=~“INT-API”, mode=“user”}[5m])) > 0

But, that will return a differant values of CPU, depending on the (mode), I will get (uses CPU usage, and System CPU usage) as different values.

How can I write this query to return the sum of all of these different values as one number?

Hey There,

Ideally, you shouldn’t be calculating the CPU usage as the sum of all seconds spent on all modes.

I believe a better alert query for your scneario can be seen at awesome-prometheus-alerts.

1 Like