以下是警报和相应的Alertmanager配置文件设置(alertmanager.yml)的所有不同示例。 每个都使用Go模板系统。
一、自定义Slack通知
在这个例子中,我们定制了Slack通知,以便向我们组织的wiki发送一个URL,告知如何处理已发送的特定警报。
global:
slack_api_url: '<slack_webhook_url>'
route:
receiver: 'slack-notifications'
group_by: [alertname, datacenter, app]
receivers:
- name: 'slack-notifications'
slack_configs:
- channel: '#alerts'
text: 'https://internal.myorg.net/wiki/alerts/{
{ .GroupLabels.app }}/{
{ .GroupLabels.alertname }}'
二、访问CommonAnnotations中的注释
在这个例子中,我们再次定制发送给Slack接收器的文本,访问存储在Alertmanager发送的数据的CommonAnnotations
中的摘要和描述。
警报
groups:
- name: Instances
rules:
- alert: InstanceDown
expr: up == 0
for: 5m
labels:
severity: page
# Prometheus templates apply here in the annotation and label fields of the alert.
annotations:
description: '{
{