Ah ok,

I would have thought this was one-to-one because for each metric that
exists in ltmPoolMbrStatusAvailState there is one exact match within
ltmPoolMbrStatusEnabledState. Not multiple.

Unless I’m reading the definitions wrong.

Thanks

On Tue, 7 Mar 2023 at 12:06, Brian Candler <[email protected]> wrote:

> To pick up labels from the other side, you need to list them as part of
> your group_right. e.g. (untested)
>
> ltmPoolMbrStatusAvailState *
> on(instance,ltmPoolMbrStatusNodeName,ltmPoolMbrStatusPoolName,ltmPoolMbrStatusPort)
> group_right(*foo,bar,baz*) ltmPoolMbrStatusEnabledState
>
> will pick up labels foo,bar,baz from the left side.
>
> See:
> https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches
>
> Here's a tested example:
>
> node_filesystem_avail_bytes * on (instance)
> group_left(machine,release,version) node_uname_info
>
> It's a many-to-one, where the left side is "many" and the right side is
> "one", and the given labels from node_uname_info are added to the labels
> from node_filesystem_avail_bytes.
>
> On Tuesday, 7 March 2023 at 08:58:21 UTC Nick Carlton wrote:
>
>> Thanks for your response.
>>
>> If I do `ltmPoolMbrStatusAvailState *
>> on(instance,ltmPoolMbrStatusNodeName,ltmPoolMbrStatusPoolName,ltmPoolMbrStatusPort)
>> group_right ltmPoolMbrStatusEnabledState` I get:
>>
>> `{instance="ltm01", job="f5_ltm_test", ltmPoolMbrStatusEnabledState="1",
>> ltmPoolMbrStatusNodeName="/Common/VPN1",
>> ltmPoolMbrStatusPoolName="/Common/Pool1", ltmPoolMbrStatusPort="4500",
>> prometheus="monitoring/k8s", prometheus_replica="prometheus-k8s-0"}`
>>
>> So this has `ltmPoolMbrStatusEnabledState` but not
>> `ltmPoolMbrStatusAvailState`. If I swap the metrics round:
>>
>> `ltmPoolMbrStatusEnabledState *
>> on(instance,ltmPoolMbrStatusNodeName,ltmPoolMbrStatusPoolName,ltmPoolMbrStatusPort)
>> group_right ltmPoolMbrStatusAvailState`. I get:
>>
>> `{instance="ltm01", job="f5_ltm_test", ltmPoolMbrStatusAvailState="1",
>> ltmPoolMbrStatusNodeName="/Common/VPN1",
>> ltmPoolMbrStatusPoolName="/Common/Pool1", ltmPoolMbrStatusPort="4500",
>> prometheus="monitoring/k8s", prometheus_replica="prometheus-k8s-0"}`
>>
>> This has `ltmPoolMbrStatusAvailState` but not
>> `ltmPoolMbrStatusEnabledState`
>>
>> So it seems I can get one or the other, not both. Unless im forming my
>> PromQL wrong?
>>
>> On Tuesday, 7 March 2023 at 08:31:39 UTC Brian Candler wrote:
>>
>>> It has to be done in a query - the relabelling phase of a scrape job
>>> cannot see other metrics.
>>>
>>> What you are looking for is one-to-many queries, which can pick up
>>> labels from the "one" side and apply them to the "many":
>>>
>>> https://www.robustperception.io/how-to-have-labels-for-machine-roles
>>>
>>> https://www.robustperception.io/exposing-the-software-version-to-prometheus
>>>
>>> https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches
>>> https://www.robustperception.io/left-joins-in-promql
>>>
>>> > I have tried doing a join but it only seems to bring in one of the
>>> `ltmPoolMbrStatusEnabledState` and `ltmPoolMbrStatusAvailState` metrics
>>> depending on if its a left or right join, but I would like both to appear.
>>>
>>> Can you show what query you did, the raw metrics which it used, what
>>> result you got, and what you wanted to get instead?
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Prometheus Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/prometheus-users/qlHK7r1hQVs/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/4c22a279-a51c-47db-993e-9107e54e883en%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/4c22a279-a51c-47db-993e-9107e54e883en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAC4WY5-5symx1EXEUMPeNH-0CFSaZBFY_F6C%2Babff9KLXmNDrA%40mail.gmail.com.

Reply via email to