Add Prometheus Zookeeper exporter

This commit is contained in:
Joshua Boniface 2023-12-10 12:39:35 -05:00
parent 1eb618e8f3
commit 09eba9de80
4 changed files with 34 additions and 1 deletions

View File

@ -4,6 +4,11 @@
name: zookeeper name: zookeeper
state: restarted state: restarted
- name: restart prometheus-zookeeper
service:
name: prometheus-zookeeper-exporter
state: restarted
- name: restart libvirtd - name: restart libvirtd
service: service:
name: libvirtd name: libvirtd

View File

@ -21,6 +21,26 @@
- zoo.cfg - zoo.cfg
notify: restart zookeeper notify: restart zookeeper
- name: install Prometheus zookeeper exporter if enabled
apt:
name:
- prometheus-zookeeper-exporter
register: apt_res
retries: 5
until: apt_res is success
when: enable_prometheus_exporters is defined and enable_prometheus_exporters
- name: install Prometheus zookeeper exporter config if enabled
template:
src: patroni/prometheus.env.j2
dest: /etc/default/prometheus-zookeeper-exporter
owner: prometheus
group: prometheus
mode: 0640
notify:
- restart prometheus-zookeeper
when: enable_prometheus_exporters is defined and enable_prometheus_exporters
- name: install daily vacuum script - name: install daily vacuum script
template: template:
src: zookeeper/zookeeper-vacuum.j2 src: zookeeper/zookeeper-vacuum.j2

View File

@ -0,0 +1,5 @@
# Zookeeper Prometheus exporter arguments
# {{ ansible_managed }}
# Set the zk-hosts to our cluster local IP address as this is where Zookeeper listens
ARGS="-zk-hosts='{% for node in pvc_nodes if node.hostname == this_node %}{{ node.cluster_ip }}{% endfor %}:2181'"

View File

@ -19,11 +19,14 @@ maxClientCnxns=200
autopurge.snapRetainCount=3 autopurge.snapRetainCount=3
autopurge.purgeInterval=1 autopurge.purgeInterval=1
# Enable Prometheus metrics (someday, but not today under Debian 12 or less) # Enable internal Prometheus metrics (someday, but not today under Debian 12 or less)
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=9181 #metricsProvider.httpPort=9181
#metricsProvider.exportJvmInfo=true #metricsProvider.exportJvmInfo=true
# Enable all 4LW commands; need MNTR for external Prometheus metrics
4lw.commands.whitelist=*
# Listen on port 2181 on the cluster IP # Listen on port 2181 on the cluster IP
clientPort=2181 clientPort=2181
clientPortAddress={% for node in pvc_nodes if node.hostname == this_node %}{{ node.cluster_ip }}{% endfor %} clientPortAddress={% for node in pvc_nodes if node.hostname == this_node %}{{ node.cluster_ip }}{% endfor %}