Send critical alerts via email (in addition to XMPP)

This commit is contained in:
2026-07-06 14:52:17 +02:00
parent 20f67d7261
commit 1ae5210813
2 changed files with 34 additions and 3 deletions
@@ -20,6 +20,7 @@ route:
receivers:
<% @receivers.each do |receiver| %>
- name: <%= receiver["name"] %>
<% if receiver["webhook_configs"] %>
<% receiver["webhook_configs"].each do |wc| %>
webhook_configs:
- url: "<%= @webhook_url %>"
@@ -29,3 +30,15 @@ receivers:
message: '{{ if eq .Status "resolved" }}✅{{ else if eq .CommonLabels.severity "warning" }}⚠️{{ else if eq .CommonLabels.severity "critical" }}🚨{{ end }} {{ .Status | toUpper }}: {{ .CommonLabels.alertname }}{{ if .CommonLabels.instance }} on {{ .CommonLabels.instance }}{{ end }}{{ if .CommonLabels.vm_host }} (host: {{ .CommonLabels.vm_host }}){{ end }} — {{ .CommonAnnotations.summary }}'
<% end %>
<% end %>
<% if receiver["email_configs"] %>
<% receiver["email_configs"].each do |ec| %>
email_configs:
- to: "<%= ec["to"] %>"
from: "<%= ec["from"] %>"
smarthost: "<%= ec["smarthost"] %>"
require_tls: <%= ec["require_tls"] %>
send_resolved: <%= ec["send_resolved"] %>
text: '{{ .Status | toUpper }}: {{ .CommonLabels.alertname }}{{ if .CommonLabels.instance }} on {{ .CommonLabels.instance }}{{ end }}{{ if .CommonLabels.vm_host }} (host: {{ .CommonLabels.vm_host }}){{ end }} — {{ .CommonAnnotations.summary }}'
<% end %>
<% end %>
<% end %>