Upgrade matrix-alertmanager-receiver (2025.9.10 -> 2025.9.17) and switch from computed-values to in-template logic

Ref:

- https://github.com/metio/matrix-alertmanager-receiver/releases/tag/2025.9.17
- https://github.com/metio/matrix-alertmanager-receiver/pull/94
This commit is contained in:
Slavi Pantaleev
2025-09-18 07:19:33 +03:00
parent ba4153da97
commit 25e7cac28d
3 changed files with 15 additions and 26 deletions

View File

@@ -11,7 +11,7 @@
matrix_alertmanager_receiver_enabled: true
# renovate: datasource=docker depName=docker.io/metio/matrix-alertmanager-receiver
matrix_alertmanager_receiver_version: 2025.9.10
matrix_alertmanager_receiver_version: 2025.9.17
matrix_alertmanager_receiver_scheme: https
@@ -159,30 +159,20 @@ matrix_alertmanager_receiver_config_templating_external_url_mapping: {}
# "http://prometheus:8081": https://another.prometheus.example.com
matrix_alertmanager_receiver_config_templating_generator_url_mapping: {}
# Controls the `templating.computed-values` configuration setting.
matrix_alertmanager_receiver_config_templating_computed_values: "{{ matrix_alertmanager_receiver_config_templating_computed_values_default + matrix_alertmanager_receiver_config_templating_computed_values_auto + matrix_alertmanager_receiver_config_templating_computed_values_custom }}"
matrix_alertmanager_receiver_config_templating_computed_values_default:
- values: # always set 'color' to 'yellow'
color: yellow
- values: # set 'color' to 'orange' when alert label 'severity' is 'warning'
color: orange
when-matching-labels:
severity: warning
- values: # set 'color' to 'red' when alert label 'severity' is 'critical'
color: red
when-matching-labels:
severity: critical
- values: # set 'color' to 'green' when alert status is 'resolved'
color: green
when-matching-status: resolved
matrix_alertmanager_receiver_config_templating_computed_values_auto: []
matrix_alertmanager_receiver_config_templating_computed_values_custom: []
# Controls the `templating.firing-template` configuration setting.
matrix_alertmanager_receiver_config_templating_firing_template: |-
{% raw %}
{{ $color := "yellow" }}
{{ if eq .Alert.Labels.severity "warning" }}
{{ $color = "orange" }}
{{ else if eq .Alert.Labels.severity "critical" }}
{{ $color = "red" }}
{{ end }}
{{ if eq .Alert.status "resolved" }}
{{ $color = "green" }}
{{ end }}
<p>
<strong><font color="{{ .ComputedValues.color }}">{{ .Alert.Status | ToUpper }}</font></strong>
<strong><font color="{{ $color }}">{{ .Alert.Status | ToUpper }}</font></strong>
{{ if .Alert.Labels.name }}
{{ .Alert.Labels.name }}
{{ else if .Alert.Labels.alertname }}
@@ -211,7 +201,7 @@ matrix_alertmanager_receiver_config_templating_firing_template: |-
# Controls the `templating.resolved-template` configuration setting.
matrix_alertmanager_receiver_config_templating_resolved_template: |-
{% raw %}
<strong><font color="{{ .ComputedValues.color }}">{{ .Alert.Status | ToUpper }}</font></strong>
<strong><font color="green">{{ .Alert.Status | ToUpper }}</font></strong>
{{ if .Alert.Labels.name }}
{{ .Alert.Labels.name }}
{{ else if .Alert.Labels.alertname }}

View File

@@ -24,3 +24,6 @@
when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
with_items:
- {'old': 'matrix_alertmanager_receiver_container_image_name_prefix', 'new': 'matrix_alertmanager_receiver_container_image_registry_prefix'}
- {'old': 'matrix_alertmanager_receiver_config_templating_computed_values', 'new': '<superseded by logic in the firing or resolved template; see https://github.com/metio/matrix-alertmanager-receiver/pull/94'}
- {'old': 'matrix_alertmanager_receiver_config_templating_computed_values_auto', 'new': '<superseded by logic in the firing or resolved template; see https://github.com/metio/matrix-alertmanager-receiver/pull/94'}
- {'old': 'matrix_alertmanager_receiver_config_templating_computed_values_custom', 'new': '<superseded by logic in the firing or resolved template; see https://github.com/metio/matrix-alertmanager-receiver/pull/94'}

View File

@@ -26,10 +26,6 @@ templating:
# value is the mapped value which will be available as '.GeneratorURL' in templates
generator-url-mapping: {{ matrix_alertmanager_receiver_config_templating_generator_url_mapping | to_json }}
# computation of arbitrary values based on matching alert annotations, labels, or status
# values will be evaluated top to bottom, last entry wins
computed-values: {{ matrix_alertmanager_receiver_config_templating_computed_values | to_json }}
# template for alerts in status 'firing'
firing-template: {{ matrix_alertmanager_receiver_config_templating_firing_template | to_json }}