From dab6c43169c1c996074e78ed7b49e4ab88b755f3 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Wed, 16 Nov 2022 11:42:58 +0100 Subject: [PATCH] add cadvisor to prometheus server config --- templates/conf/prometheus.yml.j2 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index 639a7d4..3390397 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -355,3 +355,19 @@ scrape_configs: regex: '(.*):9323' replacement: '${1}' {% endif %} + +{% if prometheus_cadvisor_exporter_targets is defined %} + # cadvisor # + - job_name: cadvisor + scrape_interval: 30s + static_configs: + - targets: +{% for target in prometheus_cadvisor_exporter_targets %} + - {{ target }}:8080 +{% endfor %} + relabel_configs: + - source_labels: [ __address__ ] + target_label: instance + regex: '(.*):8080' + replacement: '${1}' +{% endif %}