--- # matrix-alertmanager-receiver is a service which receives webhook payloads from Prometheus' Alertmanager and forwards them to a Matrix room. # Project source code URL: https://github.com/metio/matrix-alertmanager-receiver matrix_alertmanager_receiver_enabled: true # renovate: datasource=docker depName=docker.io/metio/matrix-alertmanager-receiver matrix_alertmanager_receiver_version: 2024.11.20 matrix_alertmanager_receiver_scheme: https # The hostname at which matrix-alertmanager-receiver is served. matrix_alertmanager_receiver_hostname: '' # The path at which matrix-alertmanager-receiver is served. # This value must either be `/` or not end with a slash (e.g. `/matrix-alertmanager-receiver`). matrix_alertmanager_receiver_path_prefix: / matrix_alertmanager_receiver_base_path: "{{ matrix_base_data_path }}/alertmanager-receiver" matrix_alertmanager_receiver_config_path: "{{ matrix_alertmanager_receiver_base_path }}/config" matrix_alertmanager_receiver_container_image_self_build: false matrix_alertmanager_receiver_container_image_self_build_repo: https://github.com/metio/matrix-alertmanager-receiver matrix_alertmanager_receiver_container_image_self_build_repo_version: "{{ 'main' if matrix_alertmanager_receiver_version == 'main' else matrix_alertmanager_receiver_version }}" matrix_alertmanager_receiver_container_src_path: "{{ matrix_alertmanager_receiver_base_path }}/container-src" matrix_alertmanager_receiver_container_image: "{{ matrix_alertmanager_receiver_container_image_name_prefix }}metio/matrix-alertmanager-receiver:{{ matrix_alertmanager_receiver_container_image_tag }}" matrix_alertmanager_receiver_container_image_name_prefix: "{{ 'localhost/' if matrix_alertmanager_receiver_container_image_self_build else matrix_alertmanager_receiver_container_image_registry_prefix }}" matrix_alertmanager_receiver_container_image_tag: "{{ matrix_alertmanager_receiver_version }}" matrix_alertmanager_receiver_container_image_force_pull: "{{ matrix_alertmanager_receiver_container_image.endswith(':main') }}" matrix_alertmanager_receiver_container_image_registry_prefix: docker.io/ # The base container network. It will be auto-created by this role if it doesn't exist already. matrix_alertmanager_receiver_container_network: '' # A list of additional container networks that the container would be connected to. # The role does not create these networks, so make sure they already exist. matrix_alertmanager_receiver_container_additional_networks: "{{ matrix_alertmanager_receiver_container_additional_networks_default + matrix_alertmanager_receiver_container_additional_networks_auto + matrix_alertmanager_receiver_container_additional_networks_custom }}" matrix_alertmanager_receiver_container_additional_networks_default: [] matrix_alertmanager_receiver_container_additional_networks_auto: [] matrix_alertmanager_receiver_container_additional_networks_custom: [] # Controls whether matrix-alertmanager-receiver metrics should be proxied (exposed) on `matrix.example.com/metrics/matrix-alertmanager-receiver` matrix_alertmanager_receiver_metrics_proxying_enabled: false matrix_alertmanager_receiver_metrics_proxying_hostname: '' matrix_alertmanager_receiver_metrics_proxying_path: /metrics/matrix-alertmanager-receiver # matrix_alertmanager_receiver_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container. # See `../templates/labels.j2` for details. # # To inject your own other container labels, see `matrix_alertmanager_receiver_container_labels_additional_labels`. matrix_alertmanager_receiver_container_labels_traefik_enabled: true matrix_alertmanager_receiver_container_labels_traefik_docker_network: "{{ matrix_alertmanager_receiver_container_network }}" matrix_alertmanager_receiver_container_labels_traefik_hostname: "{{ matrix_alertmanager_receiver_hostname }}" # The path prefix must either be `/` or not end with a slash (e.g. `/matrix-alertmanager-receiver`). matrix_alertmanager_receiver_container_labels_traefik_path_prefix: "{{ matrix_alertmanager_receiver_path_prefix }}" matrix_alertmanager_receiver_container_labels_traefik_rule: "Host(`{{ matrix_alertmanager_receiver_container_labels_traefik_hostname }}`){% if matrix_alertmanager_receiver_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_alertmanager_receiver_container_labels_traefik_path_prefix }}`){% endif %}" matrix_alertmanager_receiver_container_labels_traefik_priority: 0 matrix_alertmanager_receiver_container_labels_traefik_entrypoints: web-secure matrix_alertmanager_receiver_container_labels_traefik_tls: "{{ matrix_alertmanager_receiver_container_labels_traefik_entrypoints != 'web' }}" matrix_alertmanager_receiver_container_labels_traefik_tls_certResolver: default # noqa var-naming # Controls whether labels will be added that expose metrics (see `matrix_alertmanager_receiver_metrics_proxying_enabled`) for matrix-alertmanager-receiver matrix_alertmanager_receiver_container_labels_public_metrics_enabled: "{{ matrix_alertmanager_receiver_metrics_enabled and matrix_alertmanager_receiver_metrics_proxying_enabled }}" matrix_alertmanager_receiver_container_labels_public_metrics_traefik_path: "{{ matrix_alertmanager_receiver_metrics_proxying_path }}" matrix_alertmanager_receiver_container_labels_public_metrics_traefik_rule: "Host(`{{ matrix_alertmanager_receiver_metrics_proxying_hostname }}`) && Path(`{{ matrix_alertmanager_receiver_container_labels_public_metrics_traefik_path }}`)" matrix_alertmanager_receiver_container_labels_public_metrics_traefik_priority: 0 matrix_alertmanager_receiver_container_labels_public_metrics_traefik_entrypoints: "{{ matrix_alertmanager_receiver_container_labels_traefik_entrypoints }}" matrix_alertmanager_receiver_container_labels_public_metrics_traefik_tls: "{{ matrix_alertmanager_receiver_container_labels_public_metrics_traefik_entrypoints != 'web' }}" matrix_alertmanager_receiver_container_labels_public_metrics_traefik_tls_certResolver: "{{ matrix_alertmanager_receiver_container_labels_traefik_tls_certResolver }}" # noqa var-naming matrix_alertmanager_receiver_container_labels_public_metrics_middleware_basic_auth_enabled: false # See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users matrix_alertmanager_receiver_container_labels_public_metrics_middleware_basic_auth_users: '' # matrix_alertmanager_receiver_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. # See `../templates/labels.j2` for details. # # Example: # matrix_alertmanager_receiver_container_labels_additional_labels: | # my.label=1 # another.label="here" matrix_alertmanager_receiver_container_labels_additional_labels: '' # A list of extra arguments to pass to the container matrix_alertmanager_receiver_container_extra_arguments: [] # Controls the `--log-level` argument passed to the container process. # Valid values: error, warn, info, debug matrix_alertmanager_receiver_container_process_argument_log_level: info # A list of extra arguments to pass to the container process. matrix_alertmanager_receiver_container_process_extra_arguments: [] # List of systemd services that matrix-alertmanager-receiver-proxy.service depends on matrix_alertmanager_receiver_systemd_required_services_list: "{{ matrix_alertmanager_receiver_systemd_required_services_list_default + matrix_alertmanager_receiver_systemd_required_services_list_auto + matrix_alertmanager_receiver_systemd_required_services_list_custom }}" matrix_alertmanager_receiver_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" matrix_alertmanager_receiver_systemd_required_services_list_auto: [] matrix_alertmanager_receiver_systemd_required_services_list_custom: [] # List of systemd services that matrix-alertmanager-receiver-proxy.service wants matrix_alertmanager_receiver_systemd_wanted_services_list: [] # Controls the `http.port` configuration setting. matrix_alertmanager_receiver_config_http_port: 12345 # Controls the `http.alerts-path-prefix` configuration setting. matrix_alertmanager_receiver_config_http_alerts_path_prefix: /alerts # Controls the `http.metrics-enabled` configuration setting. matrix_alertmanager_receiver_config_http_metrics_enabled: false # Controls the `http.metrics-path` configuration setting. matrix_alertmanager_receiver_config_http_metrics_path: /metrics # Controls the `matrix.homeserver-url` configuration setting. matrix_alertmanager_receiver_config_matrix_homeserver_url: '' # Controls the `matrix.user-id` configuration setting. matrix_alertmanager_receiver_config_matrix_user_id: "@{{ matrix_alertmanager_receiver_config_matrix_user_id_localpart }}:{{ matrix_domain }}" matrix_alertmanager_receiver_config_matrix_user_id_localpart: "bot.alertmanager.receiver" # Controls the `matrix.access-token` configuration setting. matrix_alertmanager_receiver_config_matrix_access_token: '' # Controls the `matrix.room-mapping` configuration setting. # # Example: # matrix_alertmanager_receiver_config_matrix_room: # simple-name: "!qporfwt:example.com" # another-name: "!aaabaa:example.com" matrix_alertmanager_receiver_config_matrix_room_mapping: {} # Controls the `templating.external-url-mapping` configuration setting. # # The key is the original value taken from the Alertmanager payload # The value is the mapped value which will be available as '.ExternalURL' in templates # # Example: # matrix_alertmanager_receiver_config_templating_external_url_mapping: # "http://alertmanager:9093": https://alertmanager.example.com # "http://alertmanager:9094": https://another.alertmanager.example.com matrix_alertmanager_receiver_config_templating_external_url_mapping: {} # Controls the `templating.generator-url-mapping` configuration setting. # # The key is the original value taken from the Alertmanager payload # The value is the mapped value which will be available as '.ExternalURL' in templates # # Example: # matrix_alertmanager_receiver_config_templating_generator_url_mapping: # "http://prometheus:8080": https://prometheus.example.com # "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 %}

{{ .Alert.Status | ToUpper }} {{ if .Alert.Labels.name }} {{ .Alert.Labels.name }} {{ else if .Alert.Labels.alertname }} {{ .Alert.Labels.alertname }} {{ end }} >> {{ if .Alert.Labels.severity }} {{ .Alert.Labels.severity | ToUpper }}: {{ end }} {{ if .Alert.Annotations.description }} {{ .Alert.Annotations.description }} {{ else if .Alert.Annotations.summary }} {{ .Alert.Annotations.summary }} {{ end }} >> {{ if .Alert.Annotations.runbook_url }} Runbook | {{ end }} {{ if .Alert.Annotations.dashboard }} Dashboard | {{ end }} Silence

{% endraw %} # Controls the `templating.resolved-template` configuration setting. matrix_alertmanager_receiver_config_templating_resolved_template: |- {% raw %} {{ .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. # You can customize it by controlling the various variables inside it. # # For a more advanced customization, you can extend the default (see `matrix_alertmanager_receiver_configuration_extension_yaml`) # or completely replace this variable with your own template. matrix_alertmanager_receiver_configuration_yaml: "{{ lookup('template', 'templates/config.yml.j2') }}" matrix_alertmanager_receiver_configuration_extension_yaml: | # Your custom YAML configuration for matrix-alertmanager-receiver goes here. # This configuration extends the default starting configuration (`matrix_alertmanager_receiver_configuration_yaml`). # # You can override individual variables from the default configuration, or introduce new ones. # # If you need something more special, you can take full control by # completely redefining `matrix_alertmanager_receiver_configuration_yaml`. # # Example configuration extension follows: # # http: # address: '' matrix_alertmanager_receiver_configuration_extension: "{{ matrix_alertmanager_receiver_configuration_extension_yaml | from_yaml if matrix_alertmanager_receiver_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final matrix-alertmanager-receiver configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_alertmanager_receiver_configuration_yaml`. matrix_alertmanager_receiver_configuration: "{{ matrix_alertmanager_receiver_configuration_yaml | from_yaml | combine(matrix_alertmanager_receiver_configuration_extension, recursive=True) }}"