我目前正在设置grafana警报。如何自定义邮件模板,以便警报电子邮件显示服务器的ip地址、服务器的状态和节点/实例?
谢谢。
发布于 2022-06-27 21:09:57
我想了一次,然后最近我更新了我的地堑实例,它擦去了我的工作,我不得不再想一遍。第一次很艰难。
您可以使用警报中的摘要和描述部分中通过prometheus提供的标签,方法是使用以下语法:
{{$labels.instance}} {{$labels.value}}
https://prometheus.io/docs/prometheus/latest/configuration/template_examples/
唯一的问题是,必须在警报规则中的最后一个条件中使用数学表达式,才能使标签在警报的汇总部分可用。
例如,在我们的个人提醒中,我们将使用以下内容:
Machine {{$labels.instance}} is not reporting status via win-exporter.
The machine could be offline or the service could be stopped.https://stackoverflow.com/questions/71855596
复制相似问题