我们使用 Prometheus 警报管理器进行警报,我们配置了如下所示的两个接收器,Slack 和 Opsgenie。问题是我们仅在 slack 中收到警报,但在 Opsgenie 中没有收到警报,我们使用 API 密钥,它是一个工作密钥,我们对其进行了测试。无法弄清楚为什么我们也没有在 Opsgenie 中收到警报。
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 30m
receiver: 'prod_alert_slack'
routes:
# Send severity=page alerts to the pager.
- match:
severity: critical|warning|page
receiver: team-pager
receivers:
- name: team-pager
opsgenie_configs:
- responders:
- name: 'Oncall'
type: 'team'
api_key: XXXXXXXXXXXXXXXXX
- name: 'prod_alert_slack'
slack_configs:
- api_url: https://hooks.slack.com/services/XXXXXXXX/XXXXXXXXXXXX
channel: '#prodslack'
send_resolved: true
username: '{{ template "slack.default.username" . }}'
color: '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}'
title: '{{ template "slack.default.title" . }}'
title_link: '{{ template "slack.default.titlelink" . }}'
pretext: '{{ .CommonAnnotations.summary }}'
text: |-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Description:* {{ .Annotations.description }}
*Message:* {{ .Annotations.message }}
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
fallback: '{{ template "slack.default.fallback" . }}'
icon_emoji: '{{ template "slack.default.iconemoji" . }}'
icon_url: '{{ template "slack.default.iconurl" . }}'
#text: "summary: {{ .CommonAnnotations.summary }}\ndescription: {{ .CommonAnnotations.description }}"
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']```