ceph-prometheus: add alertmanager HA config

When using multiple alertmanager nodes (via the grafana-server group)
then we need to specify the other peers in the configuration.

https://prometheus.io/docs/alerting/alertmanager/#high-availability
https://github.com/prometheus/alertmanager#high-availability

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1792225

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit b9d975385c)
pull/5081/head
Dimitri Savineau 2020-02-13 15:56:23 -05:00 committed by Guillaume Abrioux
parent 9c97179fc1
commit a9a533e398
5 changed files with 19 additions and 1 deletions

View File

@ -773,6 +773,7 @@ dummy:
#alertmanager_data_dir: /var/lib/alertmanager #alertmanager_data_dir: /var/lib/alertmanager
#alertmanager_conf_dir: /etc/alertmanager #alertmanager_conf_dir: /etc/alertmanager
#alertmanager_port: 9093 #alertmanager_port: 9093
#alertmanager_cluster_port: 9094
################################## ##################################

View File

@ -773,6 +773,7 @@ alertmanager_container_image: registry.redhat.io/openshift4/ose-prometheus-alert
#alertmanager_data_dir: /var/lib/alertmanager #alertmanager_data_dir: /var/lib/alertmanager
#alertmanager_conf_dir: /etc/alertmanager #alertmanager_conf_dir: /etc/alertmanager
#alertmanager_port: 9093 #alertmanager_port: 9093
#alertmanager_cluster_port: 9094
################################## ##################################

View File

@ -765,6 +765,7 @@ alertmanager_container_memory: 4
alertmanager_data_dir: /var/lib/alertmanager alertmanager_data_dir: /var/lib/alertmanager
alertmanager_conf_dir: /etc/alertmanager alertmanager_conf_dir: /etc/alertmanager
alertmanager_port: 9093 alertmanager_port: 9093
alertmanager_cluster_port: 9094
################################## ##################################

View File

@ -52,6 +52,17 @@
permanent: true permanent: true
immediate: true immediate: true
state: enabled state: enabled
- name: open alertmanager cluster port
firewalld:
port: "{{ alertmanager_cluster_port }}/{{ item }}"
zone: "{{ ceph_dashboard_firewall_zone }}"
permanent: true
immediate: true
state: enabled
with_items:
- "tcp"
- "udp"
when: when:
- grafana_server_group_name is defined - grafana_server_group_name is defined
- grafana_server_group_name in group_names - grafana_server_group_name in group_names

View File

@ -22,9 +22,13 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name=alertmanager \
--memory-swap={{ alertmanager_container_memory * 2 }}GB \ --memory-swap={{ alertmanager_container_memory * 2 }}GB \
{{ alertmanager_container_image }} \ {{ alertmanager_container_image }} \
--config.file=/etc/alertmanager/alertmanager.yml \ --config.file=/etc/alertmanager/alertmanager.yml \
--cluster.listen-address={{ grafana_server_addr }}:{{ alertmanager_cluster_port }} \
{% for peer in grafana_server_addrs|difference(grafana_server_addr) %}
--cluster.peer={{ peer }}:{{ alertmanager_cluster_port }} \
{% endfor %}
--storage.path=/alertmanager \ --storage.path=/alertmanager \
--web.external-url=http://{{ ansible_fqdn }}:{{ alertmanager_port }}/ \ --web.external-url=http://{{ ansible_fqdn }}:{{ alertmanager_port }}/ \
--web.listen-address=:{{ alertmanager_port }} --web.listen-address={{ grafana_server_addr }}:{{ alertmanager_port }}
ExecStop=/usr/bin/{{ container_binary }} stop alertmanager ExecStop=/usr/bin/{{ container_binary }} stop alertmanager
Restart=always Restart=always
RestartSec=10s RestartSec=10s