From 6906b275ef58c5d35bef73fd64054925e9a7fa15 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Mon, 14 Dec 2020 18:29:21 +0000 Subject: [PATCH] Switch prometheus to active/passive mode This uses the same approach as the mariadb role (and others). Closes-Bug: #1928193 Co-Authored-By: John Garbutt Change-Id: I79a7a8c80327cfd9ef31d17fe71f450a181a638c --- ansible/roles/prometheus/defaults/main.yml | 7 +++++++ .../prometheus-active-passive-be4fb033493e958f.yaml | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 releasenotes/notes/prometheus-active-passive-be4fb033493e958f.yaml diff --git a/ansible/roles/prometheus/defaults/main.yml b/ansible/roles/prometheus/defaults/main.yml index b1c1174609..5e9ecdf916 100644 --- a/ansible/roles/prometheus/defaults/main.yml +++ b/ansible/roles/prometheus/defaults/main.yml @@ -15,6 +15,7 @@ prometheus_services: mode: "http" external: false port: "{{ prometheus_port }}" + custom_member_list: "{{ prometheus_haproxy_members.split(';') }}" prometheus-node-exporter: container_name: prometheus_node_exporter group: prometheus-node-exporter @@ -100,6 +101,12 @@ prometheus_services: #################### prometheus_mysql_exporter_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}prometheus{% endif %}" +#################### +# HAProxy +#################### +prometheus_active_passive: true +prometheus_haproxy_members: "{% for host in groups['prometheus'] %}server {{ hostvars[host].ansible_facts.hostname }} {{ 'api' | kolla_address(host) }}:{{ prometheus_port }} check inter 2000 rise 2 fall 5{% if not loop.first %}{% if prometheus_active_passive | bool %} backup{% endif %}{% endif %};{% endfor %}" + #################### # Blackbox #################### diff --git a/releasenotes/notes/prometheus-active-passive-be4fb033493e958f.yaml b/releasenotes/notes/prometheus-active-passive-be4fb033493e958f.yaml new file mode 100644 index 0000000000..54eb22c8aa --- /dev/null +++ b/releasenotes/notes/prometheus-active-passive-be4fb033493e958f.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + Prometheus has been switched to active/passive mode. This is enabled by + default but can be turned off by setting ``prometheus_active_passive`` to + ``no``. + See bug `1928193 + `__. +fixes: + - | + Fixes an issue with misaligned data points in grafana when loadbalancing + over multiple prometheus server instances. See bug `1928193 + `__.