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

Alertmanager未触发邮件通知:配置邮件接收器后无响应求助

Alertmanager邮件接收器无响应问题排查

问题描述

通过Docker运行Alertmanager,配置的Teams、Slack通知可正常触发,但邮件接收器mail-notif完全无响应。其中teams-notif可正常工作,能在Teams中收到告警,mail-notif却毫无动静。

配置文件

global:
smtp_smarthost: "192.168.1.1:25"
smtp_from: "test@test.com"

templates: 
- /etc/alertmanager/templates/*.tmpl

# The root route on which each incoming alert enters.
route:
group_by: [ "alertname", "cluster", "service" ]
group_wait: 30s # How long to wait to send a notification for a new group of alerts.
group_interval: 1m # How long to wait before sending a notification about new alerts that are added to an existing group of alerts.
repeat_interval: 3h 

# A default receiver
receiver: default-group


routes:

  - receiver: 'mail-notif'
    group_by: ["hostname", "alertname"]
    repeat_interval: 1h
    group_wait: 0s
    group_interval: 1s

  - receiver: 'teams-notif'
    group_by: ["hostname", "alertname"]
    repeat_interval: 1h
    group_wait: 0s
    group_interval: 1s

receivers:

- name: mail-notif
  email_configs:
    - to: 'myself@test.com'


- name: teams-notif
  webhook_configs:
    - url: "http://192.1.1.1:2001/TEAMS_INCOMING_WEBHOOK_URL_TEST"
      send_resolved: true

前置验证

SMTP配置已验证:在Docker容器内通过telnet测试正常,本地用swaks测试也能收到测试邮件。执行docker logs alertmanager 2>&1 | grep mail-notif无任何输出。


编辑补充

感谢@markalex,发现缺少continue: true配置!现在日志中能看到:

caller=notify.go:743 level=debug component=dispatcher receiver=teams-test-sendmail integration=email[0] msg="Notify success" attempts=1

已将smtp_require_tls设为false,但仍未收到告警邮件。请问是否必须使用模板?


解答

  1. 模板并非强制要求:Alertmanager邮件接收器自带默认模板,即使没有自定义模板,也会生成包含告警基本信息的邮件并发送,不需要必须配置自定义模板。

  2. 后续排查方向:

    • 检查SMTP服务器投递日志:Alertmanager显示"Notify success"仅代表邮件已提交给SMTP服务器,但服务器可能在转发、投递环节出现问题(比如被收件方邮箱判定为垃圾邮件、收件地址有误等),需要查看SMTP服务器的日志确认邮件流向。
    • 补充SMTP配置参数:如果SMTP服务器需要认证,需添加smtp_auth_username和smtp_auth_password参数;也可以尝试配置smtp_hello字段,确保SMTP会话符合服务器要求。
    • 模拟告警测试:使用amtool工具模拟告警发送,或者手动触发一个真实告警,查看Alertmanager生成的邮件内容是否正常,是否存在格式问题导致被拦截。
    • 确认路由匹配:将Alertmanager日志级别调整为debug,查看完整的路由匹配流程,确保告警确实匹配到了mail-notif的路由规则,没有被其他规则过滤。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 00:43:12