From d1866278ec48e55ad59f6d35819628d02214addc Mon Sep 17 00:00:00 2001
From: Thomas Schneider <tschneider@asta.rwth-aachen.de>
Date: Fri, 20 Mar 2020 21:54:43 +0100
Subject: [PATCH] Add "job: node" label to node_exporter jobs

---
 node_exporter/templates/scrape.yml.j2  | 2 ++
 prometheus/templates/prometheus.yml.j2 | 1 +
 2 files changed, 3 insertions(+)

diff --git a/node_exporter/templates/scrape.yml.j2 b/node_exporter/templates/scrape.yml.j2
index 5b53817..cb5b3ef 100644
--- a/node_exporter/templates/scrape.yml.j2
+++ b/node_exporter/templates/scrape.yml.j2
@@ -1,2 +1,4 @@
 - targets:
   - "{{ ansible_fqdn }}:9100"
+  labels:
+    job: node
diff --git a/prometheus/templates/prometheus.yml.j2 b/prometheus/templates/prometheus.yml.j2
index a45cc14..67dadda 100644
--- a/prometheus/templates/prometheus.yml.j2
+++ b/prometheus/templates/prometheus.yml.j2
@@ -20,6 +20,7 @@ scrape_configs:
         - 'localhost:9090'
 
   - job_name: dynamic_scrapers
+    honor_labels: true
     file_sd_configs:
       - files:
         - /etc/prometheus/scrape/*.yml
-- 
GitLab