From 7366735a89904ea4c4c98f7a9f9fc506ed9079c2 Mon Sep 17 00:00:00 2001 From: Camille Prugnard Date: Tue, 12 Oct 2021 15:46:38 +0200 Subject: [PATCH] add custom labels for mongodb --- templates/conf/prometheus.yml.j2 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index d78619f..7bfc860 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -58,11 +58,22 @@ scrape_configs: scrape_interval: 30s scrape_timeout: 10s static_configs: +{% if prometheus_mongodb_exporter_custom is defined %} +{% for target in prometheus_mongodb_exporter_custom.values() %} + - targets: ['{{ target.node_name }}:9216'] + labels: + environment: '{{ target.environment }}' + node_name: '{{ target.node_name }}' + service_name: '{{ target.service_name }}' + cluster: '{{ target.cluster }}' +{% endfor %} +{% else %} - targets: {% for target in prometheus_mongodb_exporter_targets %} - {{ target }}:9216 {% endfor %} {% endif %} +{% endif %} {% if prometheus_postgres_exporter_targets is defined %} - job_name: postgresql