32 lines
1.1 KiB
Plaintext
32 lines
1.1 KiB
Plaintext
global:
|
|
resolve_timeout: 5m
|
|
|
|
route:
|
|
<% @route.each do |k, v| %>
|
|
<% if k == "routes" && v.is_a?(Array) && !v.empty? %>
|
|
routes:
|
|
<% v.each do |child| %>
|
|
- receiver: <%= child["receiver"] %>
|
|
<% child.each do |ck, cv| %>
|
|
<% next if ck == "receiver" %>
|
|
<%= ck %>: <%= cv.is_a?(Array) ? cv.inspect : cv %>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= k %>: <%= v.is_a?(Array) ? v.inspect : v %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
receivers:
|
|
<% @receivers.each do |receiver| %>
|
|
- name: <%= receiver["name"] %>
|
|
<% receiver["webhook_configs"].each do |wc| %>
|
|
webhook_configs:
|
|
- url: "<%= @webhook_url %>"
|
|
send_resolved: <%= wc["send_resolved"] %>
|
|
payload:
|
|
room: "<%= wc["room"] %>"
|
|
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 %>
|