Add the results of 2 queries

I have 2 queries:

rPDU2PhasePower{rPDU2PhasePowerIndex="1"} / 10

and

rPDU2PhasePower{rPDU2PhasePowerIndex="2"} / 10

I want to combine the results of each query into one that has the combined usage on both phases.

The queries are named “Usage1” and “Usage2”, the following expression does not work:
$Usage1 + $Usage2

I can change it to:

$Usage1 + $Usage1

and it results in 2x usage1, but it doesn’t seem to work if I combine both.

Welcome @desultory

What does “does not work” look like?

it produces no output. I can try to refresh the panel and toggle the expression and it doesn’t appear on the graph.

what do you see when you try them each separately one by one

$Usage1 first by itself
then $Usage2 by itself

I can see them one at a time. There seem to be no results when they are combined.



1 Like

So are they both series of data or they each contain a single value?

Both are time series data, I have tried using instant on either, but nothing seems to work.

Maybe I can do something in prometheus to make a new metric that is the combined value of both of those?

That Math is for math :grin: as in 5+5=10 type of thing.

What you might be looking for is the join transformation

Am I able to make alert conditions based on transformed data?

Is this question related to your original question?

Yes, sorry I was not clear in the original post.

My end goal is to add the power usage from both (or all) phases, and then alert based on that condition.

I able to use a transformation, and it gives me the total usage for ALL devices, but I can’t seem to alert on that.

I’m probably missing the method to show usage for EACH device combined, but I’d also like to alert on combined usage, and that doesn’t seem to be an option: