Prometheus监控套件安装完成后需要安装alertmanager告警功能
在Prometheus配置文件中添加如下配置段开启告警功能
global:
scrape_interval: 10s
evaluation_interval: 10s
alerting:
alertmanagers:
- static_configs:
- targets: ["monitor-alertmanager:9093"]
rule_files:
- "rules/*.yml" # 这里支持通配符,如 *.yml
alertmanager 配置文件如下:
global:
# The smarthost and SMTP sender used for mail notifications.
resolve_timeout: 5m
smtp_smarthost: 'smtp.exmail.qq.com:25'
smtp_from: '邮箱地址'
smtp_auth_username: '邮箱地址' # 邮箱用户
smtp_auth_password: '邮箱密码' # 邮箱密码
smtp_require_tls: false
# The root route on which each incoming alert enters.
route:
receiver: default
group_by: ['alertname', 'cluster']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
routes:
- match:
team: node
receiver: email
group_wait: 10s
receivers:
- name: 'default'
email_configs:
- to: '接受邮箱地址'
send_resolved: true
- name: 'email'
email_configs:
- to: '接受邮箱地址'
send_resolved: true
网友评论