From 0f2794a0756eddac3a158193bcafe2628a2882da Mon Sep 17 00:00:00 2001 From: Nathan Taylor Date: Thu, 3 Mar 2022 14:31:07 -0700 Subject: [PATCH] Adds etcd endpoints as a Prometheus scrape target Add "enable_prometheus_etcd_integration" configuration parameter which can be used to configure Prometheus to scrape etcd metrics endpoints. The default value of "enable_prometheus_etcd_integration" is set to the combined values of "enable_prometheus" and "enable_etcd". Change-Id: I7a0b802c5687e2d508e06baf55e355d9761e806f --- ansible/group_vars/all.yml | 2 ++ ansible/roles/prometheus/templates/prometheus.yml.j2 | 9 +++++++++ etc/kolla/globals.yml | 1 + .../notes/support-etcd-metrics-fdfb8f3da96dd761.yaml | 7 +++++++ 4 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/support-etcd-metrics-fdfb8f3da96dd761.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 107c3b8cf3..286bd56b30 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -457,6 +457,7 @@ prometheus_rabbitmq_exporter_port: "{{ rabbitmq_prometheus_port }}" prometheus_cadvisor_port: "18080" prometheus_fluentd_integration_port: "24231" prometheus_libvirt_exporter_port: "9177" +prometheus_etcd_integration_port: "{{ etcd_client_port }}" # Prometheus alertmanager ports prometheus_alertmanager_port: "9093" @@ -1109,6 +1110,7 @@ enable_prometheus_elasticsearch_exporter: "{{ enable_prometheus | bool and enabl enable_prometheus_blackbox_exporter: "{{ enable_prometheus | bool }}" enable_prometheus_rabbitmq_exporter: "{{ enable_prometheus | bool and enable_rabbitmq | bool }}" enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool and nova_compute_virt_type in ['kvm', 'qemu'] }}" +enable_prometheus_etcd_integration: "{{ enable_prometheus | bool and enable_etcd | bool }}" prometheus_alertmanager_user: "admin" prometheus_openstack_exporter_interval: "60s" diff --git a/ansible/roles/prometheus/templates/prometheus.yml.j2 b/ansible/roles/prometheus/templates/prometheus.yml.j2 index 66dd208faf..afc9b04c15 100644 --- a/ansible/roles/prometheus/templates/prometheus.yml.j2 +++ b/ansible/roles/prometheus/templates/prometheus.yml.j2 @@ -156,6 +156,15 @@ scrape_configs: {% endfor %} {% endif %} +{% if enable_prometheus_etcd_integration | bool %} + - job_name: etcd + static_configs: + - targets: +{% for host in groups["etcd"] %} + - '{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_etcd_integration_port'] }}' +{% endfor %} +{% endif %} + {% if enable_prometheus_alertmanager | bool %} - job_name: alertmanager static_configs: diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 6855eaedc8..f505dcc032 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -710,6 +710,7 @@ #enable_prometheus_elasticsearch_exporter: "{{ enable_prometheus | bool and enable_elasticsearch | bool }}" #enable_prometheus_blackbox_exporter: "{{ enable_prometheus | bool }}" #enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool and nova_compute_virt_type in ['kvm', 'qemu'] }}" +#enable_prometheus_etcd_integration: "{{ enable_prometheus | bool and enable_etcd | bool }}" # List of extra parameters passed to prometheus. You can add as many to the list. #prometheus_cmdline_extras: diff --git a/releasenotes/notes/support-etcd-metrics-fdfb8f3da96dd761.yaml b/releasenotes/notes/support-etcd-metrics-fdfb8f3da96dd761.yaml new file mode 100644 index 0000000000..95ef0a5fc4 --- /dev/null +++ b/releasenotes/notes/support-etcd-metrics-fdfb8f3da96dd761.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Add ``enable_prometheus_etcd_integration`` configuration parameter which + can be used to configure Prometheus to scrape etcd metrics endpoints. + The default value of ``enable_prometheus_etcd_integration`` is set to + the combined values of ``enable_prometheus`` and ``enable_etcd``.