Files
compose-anything/src/node-exporter/docker-compose.yaml
2025-11-10 19:55:44 +08:00

42 lines
1.1 KiB
YAML

x-defaults: &defaults
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
node-exporter:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}prom/node-exporter:${NODE_EXPORTER_VERSION:-v1.8.2}
ports:
- "${NODE_EXPORTER_PORT_OVERRIDE:-9100}:9100"
command:
- '--path.rootfs=/host'
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
environment:
- TZ=${TZ:-UTC}
volumes:
- '/:/host:ro,rslave'
deploy:
resources:
limits:
cpus: ${NODE_EXPORTER_CPU_LIMIT:-0.25}
memory: ${NODE_EXPORTER_MEMORY_LIMIT:-128M}
reservations:
cpus: ${NODE_EXPORTER_CPU_RESERVATION:-0.1}
memory: ${NODE_EXPORTER_MEMORY_RESERVATION:-64M}
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9100/metrics"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Run with host network for accurate metrics
# network_mode: host
volumes: {}