feat: standalone node-exporter + telegraf compose per node
Post-Swarm: node-exporter must run standalone with pid:host, since Swarm mode blocked it and cross-node /proc namespaces contaminated swap metrics. Marks the stacks/ definition superseded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
node-exporter:
|
||||||
|
image: prom/node-exporter:v1.7.0
|
||||||
|
container_name: node-exporter
|
||||||
|
hostname: bart
|
||||||
|
network_mode: host
|
||||||
|
pid: host
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/rootfs:ro
|
||||||
|
command:
|
||||||
|
- '--path.procfs=/host/proc'
|
||||||
|
- '--path.rootfs=/rootfs'
|
||||||
|
- '--path.sysfs=/host/sys'
|
||||||
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=false"
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
telegraf:
|
||||||
|
image: telegraf:latest
|
||||||
|
container_name: telegraf
|
||||||
|
hostname: bart
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- HOST_PROC=/host/proc
|
||||||
|
- HOST_SYS=/host/sys
|
||||||
|
- HOST_ETC=/host/etc
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker-data/configs/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /etc:/host/etc:ro
|
||||||
|
mem_limit: 512M
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
node-exporter:
|
||||||
|
image: prom/node-exporter:v1.7.0
|
||||||
|
container_name: node-exporter
|
||||||
|
hostname: hf-pdocker-01
|
||||||
|
network_mode: host
|
||||||
|
pid: host
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/rootfs:ro
|
||||||
|
command:
|
||||||
|
- '--path.procfs=/host/proc'
|
||||||
|
- '--path.rootfs=/rootfs'
|
||||||
|
- '--path.sysfs=/host/sys'
|
||||||
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=false"
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
telegraf:
|
||||||
|
image: telegraf:latest
|
||||||
|
container_name: telegraf
|
||||||
|
hostname: hf-pdocker-01
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- HOST_PROC=/host/proc
|
||||||
|
- HOST_SYS=/host/sys
|
||||||
|
- HOST_ETC=/host/etc
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker-data/configs/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /etc:/host/etc:ro
|
||||||
|
mem_limit: 512M
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
node-exporter:
|
||||||
|
image: prom/node-exporter:v1.7.0
|
||||||
|
container_name: node-exporter
|
||||||
|
hostname: hf-pdocker-02
|
||||||
|
network_mode: host
|
||||||
|
pid: host
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/rootfs:ro
|
||||||
|
command:
|
||||||
|
- '--path.procfs=/host/proc'
|
||||||
|
- '--path.rootfs=/rootfs'
|
||||||
|
- '--path.sysfs=/host/sys'
|
||||||
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
|
labels:
|
||||||
|
- "com.centurylinklabs.watchtower.enable=false"
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
telegraf:
|
||||||
|
image: telegraf:latest
|
||||||
|
container_name: telegraf
|
||||||
|
hostname: hf-pdocker-02
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- HOST_PROC=/host/proc
|
||||||
|
- HOST_SYS=/host/sys
|
||||||
|
- HOST_ETC=/host/etc
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker-data/configs/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /etc:/host/etc:ro
|
||||||
|
mem_limit: 512M
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "3"
|
||||||
@@ -1,7 +1,16 @@
|
|||||||
|
# SUPERSEDED 2026-03-21: Do NOT deploy this as a Swarm stack.
|
||||||
|
# Swarm mode blocks pid: host, causing cross-node /proc namespace contamination
|
||||||
|
# where node-exporter reads wrong host's memory metrics.
|
||||||
|
# Use standalone Compose on each node instead:
|
||||||
|
# compose/hf-pdocker-01/node-exporter/docker-compose.yml
|
||||||
|
# compose/hf-pdocker-02/node-exporter/docker-compose.yml
|
||||||
|
# compose/bart/node-exporter/docker-compose.yml
|
||||||
|
|
||||||
services:
|
services:
|
||||||
node-exporter:
|
node-exporter:
|
||||||
image: prom/node-exporter:latest
|
image: prom/node-exporter:v1.7.0
|
||||||
hostname: "{{.Node.Hostname}}"
|
hostname: "{{.Node.Hostname}}"
|
||||||
|
pid: host
|
||||||
ports:
|
ports:
|
||||||
- "9100:9100"
|
- "9100:9100"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -12,6 +21,7 @@ services:
|
|||||||
- '--path.procfs=/host/proc'
|
- '--path.procfs=/host/proc'
|
||||||
- '--path.rootfs=/rootfs'
|
- '--path.rootfs=/rootfs'
|
||||||
- '--path.sysfs=/host/sys'
|
- '--path.sysfs=/host/sys'
|
||||||
|
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file"
|
||||||
options:
|
options:
|
||||||
|
|||||||
Reference in New Issue
Block a user