From 4fea9e9b7f4c8a2c033ca1929aa62af05ef7b9e4 Mon Sep 17 00:00:00 2001 From: "lin.huang" Date: Wed, 15 Nov 2023 15:02:16 +0800 Subject: [PATCH] feature: add alertmanager function --- config/email.tmpl | 4 ++-- config/instanceDown_rules.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/email.tmpl b/config/email.tmpl index 48ced598e..9de3463ce 100644 --- a/config/email.tmpl +++ b/config/email.tmpl @@ -1,6 +1,6 @@ {{ define "email.to.html" }} {{ range .Alerts }} - +--------------------------------------------------------- 告警程序: prometheus_alert
告警级别: {{ .Labels.severity }} 级
告警类型: {{ .Labels.alertname }}
@@ -8,6 +8,6 @@ 故障服务: {{ .Labels.job }}
告警主题: {{ .Annotations.summary }}
触发时间: {{ .StartsAt.Format "2020-01-02 15:04:05"}}
- +---------------------------------------------------------- {{ end }} {{ end }} \ No newline at end of file diff --git a/config/instanceDown_rules.yml b/config/instanceDown_rules.yml index b266e4e73..72b1f5aa3 100644 --- a/config/instanceDown_rules.yml +++ b/config/instanceDown_rules.yml @@ -1,11 +1,11 @@ groups: - - name: node_down + - name: instance_down rules: - alert: InstanceDown expr: up == 0 for: 1m labels: - user: test + severity: critical annotations: summary: "Instance {{ $labels.instance }} down" description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes." \ No newline at end of file