You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Prometheus/Alertmanager告警路由问题:无法按规则分发至对应邮箱

问题解答

一、两类告警均发送至默认接收器的原因

你的Alertmanager路由匹配规则存在语法错误:在Alertmanager的标签匹配逻辑中,相等匹配必须使用==操作符,而你配置里写的是=(alertname="EPG_build_too_long"、alertname="APP_build_too_long")。这种错误写法会导致APP_build_too_long告警无法匹配到对应的路由规则,最终触发默认接收器EmailNotifications-EPG。

修正匹配语法后,告警就能按预期路由到对应接收器。

二、通用邮箱配置迁移至global段的可行性

完全可以将SMTP通用配置迁移到global段,Alertmanager支持全局定义SMTP参数,避免重复配置。修改后的完整配置示例如下:

global:
  resolve_timeout: 1m
  # 全局SMTP通用配置
  smtp_from: "Monitor <monitor@company.com>"
  smtp_smarthost: mail.company.com:25
  smtp_auth_username: monitor@company.com
  smtp_auth_identity: monitor@company.com
  smtp_auth_password: "..."
route:
  receiver: "EmailNotifications-EPG"
  routes:
    - receiver: "EmailNotifications-EPG"
      matchers:
        - alertname == "EPG_build_too_long"
    - receiver: "EmailNotifications-APP"
      matchers:
        - alertname == "APP_build_too_long"
receivers:
- name: "EmailNotifications-EPG"
  email_configs:
  - to: e1@company.com,e2@company.com
    send_resolved: true
- name: "EmailNotifications-APP"
  email_configs:
  - to: e1@company.com,e3@company.com
    send_resolved: true

内容的提问来源于stack exchange,提问作者user1876484

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 21:46:24