Hi Christian, I think you mis-understood the question. The breaching threshold used foralerting is something I want to print in the description or the summary part of the alert
On Sat, Mar 14, 2020 at 4:56 PM Christian Hoffmann < [email protected]> wrote: > 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/CAC8587vYj4Y3QWioyR4ZRAvsbX2roSY4VTw0PU2cdiGC32PLmw%40mail.gmail.com.

