Prometheus Query with Join

276 views
Skip to first unread message

arnav...@gmail.com

unread,
Sep 20, 2018, 12:09:37 PM9/20/18
to Prometheus Developers
I have one metric, ideally it should be == 4. So, in case the value is 5 I should fire an alert. but the trick is, I have to check first if the value was 4 some time back (30 mins) and has now became 5 or not.

I thought I will have two separate expressions: 1) K_RpdStatus_Value offset 30m and 2) K_RpdStatus_Value.

Then I will join these two expressions based on a common label = MacAddress. But I think I am getting the syntax wrong. so the join is not working. Please guide me to handle two metrics or expressions in a single prometheus query.

Ben Kochie

unread,
Sep 20, 2018, 12:47:32 PM9/20/18
to Arnav Bose, Prometheus Developers
This should be as simple as this:

K_RpdStatus_Value offset 30m == 4 and K_RpdStatus_Value == 5

Prometheus will automatically match each side on the label values.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To post to this group, send email to prometheus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/a17bc220-0d49-45de-859c-d23d2462e966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

arnav...@gmail.com

unread,
Sep 20, 2018, 1:10:37 PM9/20/18
to Prometheus Developers
I tried with this but prometheus keeps on loading and never comes back. In case it does not find a match, it should return immediately, correct? the two expressions work fine independently as well as if use OR in place of AND. So, there is no issue with the syntax there. But somehow if I use AND query keeps loading and never comes back.
Reply all
Reply to author
Forward
0 new messages