From 2ec46198efa3d1d47d5e4af0fbf6d80fda3be91c Mon Sep 17 00:00:00 2001 From: Tom <58692790+tchivert@users.noreply.github.com> Date: Wed, 1 Jun 2022 15:25:02 +0200 Subject: [PATCH] Remove port from node hosts Add a relabel rule to the "node" job to hide the port number from instances names. --- templates/conf/prometheus.yml.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index 04673ac..c30328d 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -41,6 +41,11 @@ scrape_configs: {% for target in prometheus_node_exporter_targets %} - {{ target }}:9100 {% endfor %} + relabel_configs: + - source_labels: [ __address__ ] + target_label: instance + regex: '(.*):9100' + replacement: '${1}' {% endif %} {% if prometheus_mysqld_exporter_targets is defined %}