Search code examples
loadprometheusdivisionpromqlprometheus-node-exporter

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

  • Use:

    node_load1 / count by (group, instance, job) (node_cpu_seconds_total{mode="idle"})