alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Alertmanager inhibit_rules source/target_matchers seems not work

Open workhardcc opened this issue 4 years ago • 2 comments

What did you do? We configured inhibit_rules expect some alert will not firing in some condition but not. What did you expect to see? We believe that if "alert:MyFirstAlert" firing first (as below config) , then "alert:MyThirdAlert" enter firing(active) status alertmanager should inhibit it. What did you see instead? Under which circumstances? As above, "alert:MyThirdAlert" still alarm Environment

  • System information: Linux alertmanager-6c454df959-79fjk 4.9.151

  • Alertmanager version:

Version:0.22.2

  • Prometheus version:

Version | 2.29.2

  • Alertmanager configuration file:
global:
  resolve_timeout: 1m
  http_config:
    follow_redirects: true
  smtp_hello: localhost
  smtp_require_tls: true
  pagerduty_url: https://events.pagerduty.com/v2/enqueue
  opsgenie_api_url: https://api.opsgenie.com/
  wechat_api_url: https://qyapi.weixin.qq.com/cgi-bin/
  victorops_api_url: https://alert.victorops.com/integrations/generic/20131114/alert/
route:
  receiver: notifier
  group_by:
  - cluster
  - component
  - alertname
  continue: false
  group_wait: 1m
  group_interval: 5m
  repeat_interval: 5m
inhibit_rules:
- source_matchers:
  - alertname="alert:MyFirstAlert"
  target_matchers:
  - alertname="alert:MySecondAlert"
  - alertname="alert:MyThirdAlert"
  • Prometheus configuration file:
global:
  scrape_interval: 1m
  scrape_timeout: 30s
  evaluation_interval: 1m
  external_labels:
    external_group: cluster-prometheus
alerting:
  alertmanagers:
  - follow_redirects: true
    scheme: http
    timeout: 10s
    api_version: v1
    static_configs:
    - targets:
      - alertmanager.kube-system.svc.haha:9093
  • Logs:

workhardcc avatar Mar 04 '22 13:03 workhardcc

Your current target_matchers will never match anything (it says that alertname should be equal to alert:MySecondAlert and alert:MyThirdAlert). You probably want this instead:

inhibit_rules:
- source_matchers:
  - alertname="alert:MyFirstAlert"
  target_matchers:
  - alertname=~"alert:MySecondAlert|alert:MyThirdAlert"

simonpasquier avatar Mar 04 '22 13:03 simonpasquier

I'm closing it for now. If you have further questions, please use our user mailing list, which you can also search.

simonpasquier avatar Mar 04 '22 16:03 simonpasquier