普罗米修斯警报管理员只发送邮件



我有prometheus alertmanager和简单规则

普罗米修斯

  • 作业名称:"主机_PRO";static_configs:

    • 目标:["192.168.0.17:9100"]标签:组:"alert">
  • 作业名称:"主机_ PRE";static_configs:

    • 目标:["10.2.2.235:9100"]标签:组:"noalert"名称:"PVE">

alertmanager.yml

global:
# The smarthost and SMTP sender used for mail notifications.
smtp_smarthost: 'example:587'
smtp_from: 'example'
smtp_auth_username: 'example'
smtp_auth_password: 'example'
smtp_require_tls: true
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 24h
routes:
- match:
group: alert 
receiver: mail
receivers:
- name: 'mail'
email_configs:
- to: 'example@gmail.com'

规则示例

- alert: NodeCPU_0_High
expr: 100 - (avg by(instance, cpu) (irate(node_cpu_seconds_total{mode="idle", cpu="0"}[1m])) * 100) > 80
for: 2m
labels:
severity: critical
app_type: linux
category: cpu
annotations:
summary: "Node CPU_0 usage is HIGH"
description: "CPU_0 load for instance {{ $labels.instance }} has reached {{ $value }}%"

如何发送电子邮件只有当主机与组";警报";是高吗?

在alertmanager.yml文件中设置以下内容:

route:
...
routes:
- receiver: none
matchers:
- group != alert
- receiver: mail
matchers:
- group = alert 
receivers:
- name: none
- name: 'mail'
email_configs:
- to: 'example@gmail.com'

最新更新