可能需要检查以下两个文件中的SMTP设置:
确保SMTP服务器的设置正确,包括主机名,端口号等,并且在SMTP服务器上设置了权限。
以下是一个示例alertmanager.yaml文件中SMTP配置的例子:
global:
smtp_smarthost: 'smtp.example.com:587'
smtp_from: 'alertmanager@example.com'
smtp_auth_username: 'username'
smtp_auth_password: 'password'
smtp_require_tls: true
route:
group_by: ['alertname']
receiver: 'email-receiver'
receivers:
- name: 'email-receiver'
email_configs:
- to: 'admin@example.com'
send_resolved: true
在alertmanager.conf文件中,可以设置SMTP webhook的URL地址。以下是示例:
route:
group_wait: 10s
group_interval: 10s
repeat_interval: 4h
receiver: 'email'
receivers:
- name: 'email'
webhook_configs:
- url: 'http://smtp.example.com/send_email'
如果仍然遇到连接被拒绝的问题,可以尝试使用命令行工具检查连接。可以尝试使用以下命令:
telnet smtp.example.com 587
如果连接被否决,则需要联系SMTP服务器管理员以获取支持。