| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- # ============================================================
- # AlertManager 配置 - 告警路由与通知
- # ============================================================
-
- global:
- resolve_timeout: 5m
-
- # ==================== 告警模板 ====================
- templates:
- - '/etc/alertmanager/templates/*.tmpl'
-
- # ==================== 路由规则 ====================
- route:
- group_by: ['alertname', 'job']
- group_wait: 30s
- group_interval: 5m
- repeat_interval: 4h
- receiver: 'wecom'
-
- routes:
- # 严重告警 - 立即通知
- - match:
- severity: critical
- receiver: 'wecom-critical'
- group_wait: 10s
- repeat_interval: 1h
-
- # 普通告警
- - match:
- severity: warning
- receiver: 'wecom'
- repeat_interval: 4h
-
- # ==================== 接收器 ====================
- receivers:
- # 企业微信通知 - 普通告警
- - name: 'wecom'
- webhook_configs:
- - url: 'http://wecom-alert-proxy:8080/alert'
- send_resolved: true
- http_config:
- follow_redirects: true
-
- # 企业微信通知 - 严重告警
- - name: 'wecom-critical'
- webhook_configs:
- - url: 'http://wecom-alert-proxy:8080/alert-critical'
- send_resolved: true
- http_config:
- follow_redirects: true
-
- # ==================== 告警抑制 ====================
- inhibit_rules:
- # 同一告警,critical 触发时抑制 warning
- - source_match:
- severity: 'critical'
- target_match:
- severity: 'warning'
- equal: ['alertname', 'instance']
-
- # 服务宕机时抑制该服务的其他告警
- - source_match:
- alertname: 'ServiceDown'
- target_match_re:
- alertname: 'ServiceSlowResponse|HighErrorRate'
- equal: ['job']
|