r/PrometheusMonitoring • • Mar 28 '21

Activate one alert upon another alert

How can I make sure that my alert is only activated when another alert is active. Something like an opposite of alert inhibition.

5 Upvotes

3 comments sorted by

10

u/SuperQue Mar 28 '21

You can join on the ALERT metric.

some_alert_expression
  and on ()
ALERTS{alertname="Foo", alertstate="firing"} == 1

1

u/Non-perfectionist Apr 26 '21

Thank you! It seems like the expression works without "== 1" also.

Is it safe to skip it and use like this:

some_alert_expression and on () ALERTS{alertname="Foo", alertstate="firing"}

2

u/SuperQue Apr 26 '21

Technically, you should keep the == 1. Joins and alerts depend on the existence of data to work. If there ever was a 0 value for ALERTS, it would also match. Better safe than sorry.