I want the threshold to be as a variable, I dont want to use it in static
way.
FYI, Similar to {{ $value }} I would like to know if there is something
like {{ $threshold }} to print my alert threshold.
On Sat, Mar 14, 2020 at 7:58 PM Christian Hoffmann <
[email protected]> wrote:
> Hi,
>
> On 3/14/20 8:56 PM, Aditya Nageswar wrote:
> > I think you mis-understood the question.
> Which part do you mean?
>
> > The breaching threshold used foralerting is something I want to print
> > in the description or the summary part of the alert
> Yes, you can put this threshold (like a static number, e.g. 200, or a
> the value of timeseries such as foo_threshold) into the alert
> description or the summary.
>
> Kind regards,
> Christian
>
>
> > On Sat, Mar 14, 2020 at 4:56 PM Christian Hoffmann
> > <[email protected] <mailto:[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/CAC8587tehu2xQjosQpOD%3DANMWVZXuTMFgtu5phJt0r7iK_5euA%40mail.gmail.com.