> My issue with the above is that I don't have the 
`ltmPoolMbrStatusAvailState` metric with both the 
`ltmPoolMbrStatusAvailState` and `ltmPoolMbrStatusEnabledState` label 
values. Im not sure how I would manage to get the merged metric in this way.

You can nest queries as far as you need, including the 
group_left/group_right query shown before.  And if that makes them 
unmaintainable, you can use recording rules to generate new metrics 
containing the results of those queries.

> The other issue is that queries 2,3 and 4 will not return a 0 value if 
for example on number 2 there are no members that ARE available AND are NOT 
enabled, so no value is returned, im not sure how that would be handled in 
the maths operation as it would likely be "no data" rather than 0.

count(foo) counts the number of elements in instance vector foo, and if 
it's an empty vector it returns 0.

BUT: count by (foo) (bar) will only give a unique count for each value of 
the 'foo' label in the 'bar' metric (with missing/empty foo label counted 
as a separate value).  If there are no 'bar' metrics at all, then you'll 
get an empty result set.

If there is *some* metric "bar" that you can depend on always being 
present, then you can do something like
    foo or on (x,y,z) bar * 0

Bear in mind that things which *look* like Boolean operations in PromQL, 
aren't.

foo < 50      # return the instance vector "foo" trimmed to include only 
those timeseries whose value is < 50 (i.e. it's a filter)

foo or bar   # union of all values of "foo", plus those values of "bar" 
which don't have exactly matching label sets in "foo"

-- 
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/55b0403a-37b6-4cfc-80a2-0dde13266233n%40googlegroups.com.

Reply via email to