From 661df56f388902f2ab2aad0d2581a77c0e16c795 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Fri, 21 Apr 2023 15:22:24 +0200 Subject: [PATCH] add nginx config in prometheus server --- templates/conf/prometheus.yml.j2 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index 55032a5..2af5922 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -172,6 +172,23 @@ scrape_configs: regex: '(.*):9117' replacement: '${1}' +{% endif %} +{% if prometheus_nginx_exporter_targets is defined %} + # nginx exporter # + - job_name: nginx + scrape_interval: 30s + scrape_timeout: 10s + static_configs: + - targets: +{% for target in prometheus_nginx_exporter_targets %} + - {{ target }}:9113 +{% endfor %} + relabel_configs: + - source_labels: [ __address__ ] + target_label: instance + regex: '(.*):9113' + replacement: '${1}' + {% endif %} {% if prometheus_haproxy_exporter_targets is defined %} # haproxy exporter # @@ -402,6 +419,7 @@ scrape_configs: target_label: instance regex: '(.*):9221' replacement: '${1}' + {% endif %} {% if prometheus_opensearch_exporter_targets is defined %} # opensearch # @@ -424,6 +442,7 @@ scrape_configs: target_label: instance regex: '(.*):9200' replacement: '${1}' + {% endif %} {% if prometheus_gitlab_exporter_targets is defined %} # gitlab # @@ -490,4 +509,5 @@ scrape_configs: {% for target in prometheus_gitlab_exporter_targets %} - {{ target }}:9236 {% endfor %} + {% endif %}