From edd64f3c4a9d95d13a9f35d1e0d8a7d24b8d0949 Mon Sep 17 00:00:00 2001 From: Piotr Parczewski Date: Thu, 6 May 2021 14:45:10 +0200 Subject: [PATCH] Disable Alertmanager's peer gossip in non-HA deployments Reference: https://github.com/prometheus/alertmanager#turn-off-high-availability Closes-Bug: #1926463 Change-Id: I60e1dedeac25fa8fe9538a3a8e582bd8cc9324d7 (cherry picked from commit b300f7bc40bdcdeb0a520c1f3fcce85fe1b7ca72) --- .../prometheus/templates/prometheus-alertmanager.json.j2 | 2 +- .../disable-alertmanager-clustering-ec70f5f970c4933a.yaml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/disable-alertmanager-clustering-ec70f5f970c4933a.yaml diff --git a/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 b/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 index d10aa8f0cb..562b910758 100644 --- a/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 +++ b/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 @@ -1,5 +1,5 @@ { - "command": "/opt/prometheus_alertmanager/alertmanager --config.file=/etc/prometheus/alertmanager.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --web.external-url={{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} {% if groups["prometheus-alertmanager"] | length > 1 %} --cluster.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_cluster_port }} {% for host in groups["prometheus-alertmanager"] %} --cluster.peer={{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_cluster_port'] }}{% endfor %}{% endif %} --storage.path /var/lib/prometheus", + "command": "/opt/prometheus_alertmanager/alertmanager --config.file=/etc/prometheus/alertmanager.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --web.external-url={{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --cluster.listen-address={% if groups["prometheus-alertmanager"] | length > 1 %}{{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_cluster_port }} {% for host in groups["prometheus-alertmanager"] %} --cluster.peer={{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_cluster_port'] }}{% endfor %}{% endif %} --storage.path /var/lib/prometheus", "config_files": [ { "source": "{{ container_config_directory }}/prometheus-alertmanager.yml", diff --git a/releasenotes/notes/disable-alertmanager-clustering-ec70f5f970c4933a.yaml b/releasenotes/notes/disable-alertmanager-clustering-ec70f5f970c4933a.yaml new file mode 100644 index 0000000000..2fc3503a11 --- /dev/null +++ b/releasenotes/notes/disable-alertmanager-clustering-ec70f5f970c4933a.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes potential issue with Alertmanger in non-HA deployments. In this + scenario, peer gossip protocol is now disabled and Alertmanager won't + try to form a cluster with non-existing other instances. + `LP#1926463 `__