「Alertmanager」- 告警模板

定制通知模板

Notification template reference | Prometheus
Notification template examples | Prometheus

Alertmanager 发送的告警消息将通过模板(Go templating)进行渲染,然后再将其发送给接受人。

鉴于介绍 Go templating 的使用方法会偏离主题,所以该笔记不会记录 Go templating 的使用方法,与其相关内容参考 Go templating 笔记。

模板大部分是开箱即用的,通常无需定制。如果希望定制模板,需要学习以下内容:
1)学习 Go templating 使用;
2)学习 Notification template reference 文档,以了解能在模板中使用的变量;

模板配置案例

官方 Notification template examples 文档,提供简单的配置示例,涵盖几个常用场景,足够我们学习入门。

这里我们将记录我们的使用场景,及相关配置:
1)发送告警消息到多个渠道,比如 Email、Slack 等等。