From c044c815bc3aec1f231fd90de1457dae9c44b39b Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 10 Jul 2024 06:45:26 +0300 Subject: [PATCH] Fix fixing-template for matrix-alertmanager-receiver to also consider the `alertname` annotation My alerts seem to contain `annotations.alertname` in the payload, so the default configuration (coming from the matrix-alertmanager-receiver README) seems to be outdated or something. --- .../custom/matrix-alertmanager-receiver/defaults/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/custom/matrix-alertmanager-receiver/defaults/main.yml b/roles/custom/matrix-alertmanager-receiver/defaults/main.yml index 05338c638..697e5cf74 100644 --- a/roles/custom/matrix-alertmanager-receiver/defaults/main.yml +++ b/roles/custom/matrix-alertmanager-receiver/defaults/main.yml @@ -205,7 +205,12 @@ matrix_alertmanager_receiver_config_templating_firing_template: |- # Controls the `templating.resolved-template` configuration setting. matrix_alertmanager_receiver_config_templating_resolved_template: |- {% raw %} - {{ .Alert.Status | ToUpper }}{{ .Alert.Labels.name }} + {{ .Alert.Status | ToUpper }} + {{ if .Alert.Labels.name }} + {{ .Alert.Labels.name }} + {{ else if .Alert.Labels.alertname }} + {{ .Alert.Labels.alertname }} + {{ end }} {% endraw %} # Default matrix-alertmanager-receiver configuration template which covers the generic use case.