> am trying to collect informations about the cpu usage per node i wrote
> this query *sort(rate(node_cpu_seconds_total{mode="user"}[5m]) * 100
> !=0)* but this query returns values for every cpu core per node . what
> i have to do to sum the values for every core in node cpu and devide
> it on the number of cores and display the result for every node
The simple and faster way to do this is to use avg(), instead of trying
to count how many CPUs your machine has in order to divide the sum() by
it. So:
(avg( rate(node_cpu_seconds_total{mode="user"}[5m]) ) without (cpu)) * 100
(Using avg() instead of sum() divided by CPU count is not original
to me. I got the idea from a commentator on my blog, who pointed out
the equivalence.)
- cks