【发布时间】:2022-01-16 21:05:50
【问题描述】:
我有 prometheus alertmanager 和简单的规则
prometheus.yml
-
job_name:“Host_PRO” 静态配置:
- 目标:[“192.168.0.17:9100”] 标签: 组:“警报”
-
job_name:“Host_PRE” 静态配置:
- 目标:["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 }}%"
如何仅当组“警报”的主机为高时发送电子邮件?
【问题讨论】:
-
已经这样配置了吧?
-
不幸的是,我的配置不起作用 :( 仍然收到来自 noalert 组的电子邮件
-
我唯一想出但有效的方法:) link
标签: prometheus prometheus-alertmanager