On 3/13/20 9:43 AM, Brian Candler wrote:
> When you write an alert rule expression like this:
> 
> expr: foo > 200
> 
> it's just a single promQL query.  Starting with the universe of
> timeseries available, prometheus filters them down to just those where
> the metric name is "foo" and the value is > 200.  So the result of the
> query is something like this:
> 
> foo{instance="bar"} 234
> foo{instance="baz"} 911
> 
> That's what alertmanager receives from the query.  So it can tell you
> the current value, but the "threshold" doesn't exist as such. When you
> write more complex expressions, which match against multiple metrics and
> multiple conditions, you can see there's no single threshold anyway.
> 
> What you *can* do is to put your thresholds into a different
> timeseries.  See this article:
> https://www.robustperception.io/using-time-series-as-alert-thresholds

One can then put the threshold into a label or annotation. This way it
becomes part of the alert and is available to the alertmanager
notification templating. This should work with both static thresholds
from the query (which would have to be repeated) and "dynamic"
thresholds based on timeseries according to the above link.

https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
https://prometheus.io/docs/prometheus/latest/configuration/template_examples/


Kind regards,
Christian

-- 
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/8a98446b-c23d-3358-ad31-af6c8f5bca32%40hoffmann-christian.info.

Reply via email to