下载运行Alertmanager
docker run -d -p 9093:9093 -v /root/alertmanager/:/etc/alertmanager/ docker.io/prom/alertmanager:latest --config.file=/etc/alertmanager/config.yml
如果没有配置config.file会启动失败,具体原因不明。
config.yml配置
global:
smtp_smarthost: 'smtp.163.com:25'
smtp_from: '***@163.com'
smtp_auth_username: '***@163.com'
smtp_auth_password: '自己邮箱的smtp验证密码,不是邮箱密码'
smtp_require_tls: false #要设置后才能发送成功,默认是true
route:
group_interval: 1m
repeat_interval: 1m
receiver: 'mail-receiver'
receivers:
- name: 'mail-receiver'
email_configs:
- to: '***@163.com'
配置alertmanager的/opt/prometheus/rules.yml,是用来配置报警规则的
groups:
- name: test-rule
rules:
- alert: N