From 1cd6ac5b4c5358be4fbdfd0f5bffa194274e94d7 Mon Sep 17 00:00:00 2001 From: Andrew Bonney <andrew.bonney@bbc.co.uk> Date: Fri, 13 Jan 2023 09:25:11 +0000 Subject: [PATCH] Add configuration option for native Prometheus exporter Zookeeper supports Prometheus metrics as documented in https://zookeeper.apache.org/doc/r3.8.0/zookeeperMonitor.html#Prometheus This patch adds configuration options to enable it and change the default port. Change-Id: I7017bb4c2eea855464989bf10d7984e130cad4b3 --- defaults/main.yml | 3 +++ templates/zoo.cfg.j2 | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 1aa8c43..4f101f4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -160,3 +160,6 @@ zookeeper_commands_whitelist: - ruok - isro - envi + +zookeeper_prometheus_enable: False +zookeeper_prometheus_port: 7000 diff --git a/templates/zoo.cfg.j2 b/templates/zoo.cfg.j2 index 9151d3a..779deb5 100644 --- a/templates/zoo.cfg.j2 +++ b/templates/zoo.cfg.j2 @@ -56,3 +56,8 @@ ssl.quorum.enabledProtocols={{ zookeeper_ssl_protocols | join(',') }} ssl.quorum.trustStore.type=PEM ssl.quorum.clientAuth={{ zookeeper_ssl_quorum_client_auth }} {% endif %} + +{% if zookeeper_prometheus_enable | bool %} +metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider +metricsProvider.httpPort={{ zookeeper_prometheus_port }} +{% endif %}