https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches

(count by (instance)(node_cpu_seconds_total{mode="idle"})) has labels like:
{instance="nuc1"}
{instance="nuc2"}

node_load5 has labels like:
node_load5{instance="nuc1", job="node"}
node_load5{instance="nuc2", job="node"}

Since there's a one-to-one correspondence, you can simply do
node_load5 > on (instance) (count by 
(instance)(node_cpu_seconds_total{mode="idle"}))

If there were multiple values on the right for the same instance (a 1:N 
relationship), then you could do:
node_load5 > on (instance) group_right() (count by 
(instance)(node_cpu_seconds_total{mode="idle"}))

On Friday, 27 May 2022 at 17:24:10 UTC+1 [email protected] wrote:

> Does anyone know an easy way to get get a list of instances from Node 
> Exporter where the load average is greater the number of CPU's on that 
> instance?
>
> I can do this to get the CPU Count per instance: *(count by 
> (instance)(node_cpu_seconds_total{mode="idle"}))*
>
> But I can't use this because the left side isn't grouping by the instance: 
> *node_load5{}) 
> > (count by (instance)(node_cpu_seconds_total{mode="idle"}))*
>
> I could technically do this, but it seems misleading: *sum(node_load5{}) 
> by (instance) > (count by (instance)(node_cpu_seconds_total{mode="idle"}))*
>
> Any suggestions?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/f1379f5f-dc62-4d0d-887e-9bf9fab5a855n%40googlegroups.com.

Reply via email to