From 40d9924d43af018728248cbb56b2516a4748cbd8 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 19 Apr 2022 17:30:10 +0200
Subject: [PATCH] L2SS-767: Run the node-exporter on the host to be able to
 expose more host metrics

---
 docker-compose/prometheus-node-exporter.yml | 3 +--
 docker-compose/prometheus.yml               | 2 ++
 docker-compose/prometheus/prometheus.yml    | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/docker-compose/prometheus-node-exporter.yml b/docker-compose/prometheus-node-exporter.yml
index 6c1ccc2de..da82726fc 100644
--- a/docker-compose/prometheus-node-exporter.yml
+++ b/docker-compose/prometheus-node-exporter.yml
@@ -15,8 +15,7 @@ services:
       options:
         max-size: "100m"
         max-file: "10"
-    networks:
-      - control
+    network_mode: host # run on the host to be able to access host network statistics
     logging:
       driver: syslog
       options:
diff --git a/docker-compose/prometheus.yml b/docker-compose/prometheus.yml
index 8029e9ba6..f91a1a174 100644
--- a/docker-compose/prometheus.yml
+++ b/docker-compose/prometheus.yml
@@ -23,6 +23,8 @@ services:
         max-file: "10"
     networks:
       - control
+    extra_hosts:
+      - "host.docker.internal:host-gateway"
     volumes:
       - prometheus-data:/prometheus
     ports:
diff --git a/docker-compose/prometheus/prometheus.yml b/docker-compose/prometheus/prometheus.yml
index 8c847d8aa..327467727 100644
--- a/docker-compose/prometheus/prometheus.yml
+++ b/docker-compose/prometheus/prometheus.yml
@@ -13,4 +13,4 @@ scrape_configs:
     scrape_interval: 60s
     static_configs:
       - targets:
-        - "prometheus-node-exporter:9100"
+        - "host.docker.internal:9100"
-- 
GitLab