普罗米修斯警报规则

时间:2020-03-04 01:36:50

标签: prometheus prometheus-alertmanager

给出以下普罗米修斯规则:

groups:
- name: FirstAlert
  rules:

  - alert: CustomerEmailAlert
    expr: alert_email{ host="host1" } < 50
    labels:
        severity: critical
    annotations:
        summary: "Customer Email Alert"
        description: "test 1"

  - alert: DiskMonitor
    expr: physical_drive_detail{ host="host1" } == 0
    labels:
        severity: major
    annotations:
        summary: "Disk monitor"
        description: "test 2"

我有2个舞会文件,上面的规则对其进行抓取。

  1. customer-alerts.prom 其中包含:alert_email{ host="host1" } 2
  2. disk-status.prom ,其中包含:physical_drive_detail{ host="host1", size="900.1 GB", bay="5" } 1

这是我的alertmanager.yml配置,该配置将发送到slack:

receivers:
- name: 'slack-notifications'
  slack_configs:
  #-channel:'#test2'
  - channel: '#alerts'
    title: 'MyAlert'
    text: "Summary: {{ .CommonAnnotations.summary }}\n Description: {{ .CommonAnnotations.description }}"

当两个规则都满足时(我希望在松弛状态下收到2条警报,每条规则1条),我也只会收到一条警报,其中的摘要和描述也为空。

但是,当我删除一条规则(还剩下1条规则)时,它会以正确的摘要和描述轻松地警告一条规则。

我在这里做错什么还是缺少一些配置吗?

0 个答案:

没有答案