On 27.05.21 08:58, sam aram wrote: > 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?
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] [email protected] -- 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/20210609194154.GT3670%40jahnn.

