FoxVK
FoxVK

Reputation: 77

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.

Upvotes: 2

Views: 2121

Answers (2)

WangYudong
WangYudong

Reputation: 4423

Marcelo's answer shows me an empty query result.

sum(node_load5{}) by (instance) / count(node_cpu_seconds_total{mode="system"}) by (instance)

Upvotes: 1

Use:

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

Upvotes: 2

Related Questions