我如何告诉 Prometheus 的 Alertmanager 通过 Gmail 的 SMTP 服务器发送电子邮件
How do I tell Prometheus' Alertmanager to send email through Gmail's SMTP server
我希望 Prometheus 在指标超过特定阈值时从 Gmail (Gapps) 帐户发送电子邮件。
在 Alertmanager config docs 中,没有提到密码。如何向 SMTP 服务器进行身份验证?
这可以通过配置文件中的字段 auth_username
、auth_password
和 auth_identity
完成。
http://www.robustperception.io/sending-email-with-the-alertmanager-via-gmail/
上有完整的指南
确保您使用的是最新的 alertmanager,0.1.1 将无法使用。
您可以在警报管理器配置文件中使用以下模板并根据您的要求更改值。
config:
global:
resolve_timeout: 5m
route:
group_by: ['job']
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
receiver: 'tech-email'
routes:
- match:
alertname: Watchdog
receiver: 'null'
receivers:
- name: 'tech-email'
email_configs:
- to: 'to-email@example.com'
from: 'from-email@outlook.com'
auth_username: **********
auth_password: **********
require_tls: yes
smarthost: **********
send_resolved: true
- name: 'null'
对于auth_username、auth_password和smarthost,您可以从 SES 或任何提供商生成凭据。
我希望 Prometheus 在指标超过特定阈值时从 Gmail (Gapps) 帐户发送电子邮件。 在 Alertmanager config docs 中,没有提到密码。如何向 SMTP 服务器进行身份验证?
这可以通过配置文件中的字段 auth_username
、auth_password
和 auth_identity
完成。
http://www.robustperception.io/sending-email-with-the-alertmanager-via-gmail/
上有完整的指南确保您使用的是最新的 alertmanager,0.1.1 将无法使用。
您可以在警报管理器配置文件中使用以下模板并根据您的要求更改值。
config:
global:
resolve_timeout: 5m
route:
group_by: ['job']
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
receiver: 'tech-email'
routes:
- match:
alertname: Watchdog
receiver: 'null'
receivers:
- name: 'tech-email'
email_configs:
- to: 'to-email@example.com'
from: 'from-email@outlook.com'
auth_username: **********
auth_password: **********
require_tls: yes
smarthost: **********
send_resolved: true
- name: 'null'
对于auth_username、auth_password和smarthost,您可以从 SES 或任何提供商生成凭据。