I have alert for Prometheus set up in such a way that it depends on the absence of value for another alert:
- alert: Some_Alert
expr: |
round(some_expr) > 24
AND ALERTS{alertname="Empty_Source_Data_Load"} != 1
I want to calculate Some_Alert
value only when the first expression is true and Empty_Source_Data_Load
alert is absent (which means there is data). How can I do this using absent method?
You would not use absent
but rather the unless binary operator.
vector1 unless vector2 results in a vector consisting of the elements of vector1 for which there are no elements in vector2 with exactly matching label sets. All matching elements in both vectors are dropped.
The alert would be something like the following (with an ON()
clause):
- alert: Some_Alert
expr: |
round(some_expr) > 24
UNLESS ON() ALERTS{alertname="Empty_Source_Data_Load"}