'promQL how to divide node_load by number of cores
I have load.
node_load1
node_load1{group="FTP",instance="10.41.48.100:9100",job="node"} 0.1
node_load1{group="Prometheus",instance="localhost:9100",job="node"} 0.2
And I have number of cores for each instance
count(node_cpu_seconds_total{mode="idle"}) by (instance)
{instance="10.41.48.100:9100"} 1
{instance="localhost:9100"} 8
And now I need to divide it by node
label ignoring other labels.
node_load1 / on (instance) count(node_cpu_seconds_total{mode="idle"})
But result is no data.
What am I doing wrong? Is not on(<labels>)
matching only specified labels ignoring anything else?
Thank you.
Solution 1:[1]
Use:
node_load1 / count by (group, instance, job) (node_cpu_seconds_total{mode="idle"})
Solution 2:[2]
Marcelo's answer shows me an empty query result.
sum(node_load5{}) by (instance) / count(node_cpu_seconds_total{mode="system"}) by (instance)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Marcelo Ãvila de Oliveira |
Solution 2 | WangYudong |