prometheus: move node-exporter to the host network for accurate traffic stats

This commit is contained in:
Florian Lüke 2023-09-17 17:11:09 +02:00
parent 402ffae6e7
commit 08123757cd
2 changed files with 6 additions and 9 deletions

View file

@ -254,8 +254,9 @@ services:
- "traefik.http.routers.prometheus_app.tls.certresolver=myresolver"
- "traefik.http.routers.prometheus_app.middlewares=traefik_api_auth"
- "traefik.http.services.prometheus_app.loadbalancer.server.port=9090"
#extra_hosts:
# - "host.docker.internal:host-gateway"
extra_hosts:
# To be able to reach node-exporter which listens on the host network.
- "host.docker.internal:host-gateway"
grafana:
image: grafana/grafana
@ -289,19 +290,15 @@ services:
container_name: node-exporter
restart: unless-stopped
<<: *logging
#network_mode: host
# Put node-exporter on the host network to get meaningful network stats.
network_mode: host
pid: host
volumes:
#- /proc:/host/proc:ro
#- /sys:/host/sys:ro
- /:/rootfs:ro,rslave
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
command:
#- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
#- '--path.sysfs=/host/sys'
#- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
expose:
- 9100

View file

@ -10,7 +10,7 @@ scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['node-exporter:9100']
- targets: ['host.docker.internal:9100']
- job_name: 'loki'
static_configs: