format grafana ntfy alerts
This commit is contained in:
@@ -245,6 +245,31 @@ in {
|
||||
settings = {
|
||||
url = "$GRAFANA_NTFY_WEBHOOK_URL";
|
||||
httpMethod = "POST";
|
||||
title = ''
|
||||
{{ if eq .Status "resolved" }}RESOLVED{{ else }}FIRING{{ end }}: {{ index .CommonLabels "alertname" }}{{ with index .CommonLabels "target" }} {{ . }}{{ else }}{{ with index .CommonLabels "flow_id" }} {{ . }}{{ else }}{{ with index .CommonLabels "instance" }} {{ . }}{{ end }}{{ end }}{{ end }}
|
||||
'';
|
||||
message = ''
|
||||
{{ range .Alerts -}}
|
||||
{{ $labels := .Labels -}}
|
||||
{{ if eq .Status "resolved" }}✅ Resolved{{ else }}🚨 Firing{{ end }}: {{ index $labels "alertname" }}
|
||||
{{ with index $labels "target" }}Target: {{ . }}
|
||||
{{ end -}}
|
||||
{{ with index $labels "flow_id" }}Flow: {{ with index $labels "namespace_id" }}{{ . }}/{{ end }}{{ . }}
|
||||
{{ end -}}
|
||||
{{ with index $labels "instance" }}Instance: {{ . }}
|
||||
{{ end -}}
|
||||
{{ with index $labels "severity" }}Severity: {{ . }}
|
||||
{{ end -}}
|
||||
{{ with index .Annotations "description" }}Details: {{ . }}
|
||||
{{ end -}}
|
||||
{{ with .GeneratorURL }}Source: {{ . }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
'';
|
||||
headers = {
|
||||
Template = "grafana";
|
||||
Markdown = "yes";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user