From fa60f2f145e1798fedb8634ebdaf8dd5f919b775 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Tue, 2 Nov 2021 16:11:54 +0100 Subject: [PATCH] add conditions --- templates/conf/prometheus.yml.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index 5fb529a..5e026a7 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -161,6 +161,7 @@ scrape_configs: {% if prometheus_blackbox_exporter is defined %} # blacbox # +{% if prometheus_blackbox_exporter_http is defined %} {% for target in prometheus_blackbox_exporter_http.values() %} ## http check ## - job_name: blackbox - url {{ target }} @@ -180,6 +181,8 @@ scrape_configs: - target_label: __address__ replacement: localhost:9115 {% endfor %} +{% endif %} +{% if prometheus_blackbox_exporter_ping is defined %} {% for target in prometheus_blackbox_exporter_ping.values() %} ## ping ## - job_name: blackbox - ping {{ target }} @@ -199,3 +202,4 @@ scrape_configs: replacement: localhost:9115 {% endfor %} {% endif %} +{% endif %}