Alertmanager, different repeat_interval for alerts rules

874 views
Skip to first unread message

sam aram

unread,
May 27, 2021, 11:58:00 AM5/27/21
to Prometheus Users
I need to have different repeat_interval for every alert rules,
for example for alert rule1 I need it execute every 5 minutes and for aler rule 2 I need it execute once a day,
I tried to use "for" in my alert rules file:

 rules:

  - alert: rule1

    expr: <expression1>

    for: 5m

  - alert: rule2

    expr: <expression2>

    for:  1d # I also tries 1440m

 but seems it's not working

here is my alertmanager config file:

route:

  group_by: ['alertname']

  group_wait: 30s

  group_interval: 1h

  repeat_interval: 1h


is it possible to have different group_interval and repeat_interval for different alert rules? and if yes, how can I do that?

Bjoern Rabenstein

unread,
Jun 9, 2021, 3:41:59 PM6/9/21
to sam aram, Prometheus Users
First of all, note that alerting rules live on your Prometheus
server. Alert routing and grouping happens on the Alertmanager.

To strictly answer your question: You control how often an alerting
rule is evaluated in the same way as any rule. For example, you can
set it for each rule group, see
https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group

However, I don't think you want to sat that to 1d. Prometheus rules,
including alerting rules, just create other time series, and you
usually want those to get a new sample at least every 2m.

Perhaps the group_interval or the repeat_interval in the Alertmanager
config is more what you want, but I'm not sure. I recommend to read up
again in the Alertmanager documentation what they do.

In any case, you can set the group_interval and the repeat_interval
individually for every part of your routing tree, see
https://prometheus.io/docs/alerting/latest/configuration/#route

--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in
Reply all
Reply to author
Forward
0 new messages