Membuat directory dengan nama node-exporter
mkdir -p /monitoring-data/node-exporter
Membuat file docker-compose.yml didalam folder node-exporter
nano /monitoring-data/node-exporter/docker-compose.yml
Adapun isi dari docker-compose.yml sebagai berikut :
version: '3.7' services: node-exporter: image: quay.io/prometheus/node-exporter:latest container_name: node-exporter volumes: - /proc:/host/proc:ro - /sys:/host/sys:ro - /:/rootfs:ro - /:/host:ro,rslave command: - '--path.rootfs=/host' - '--path.procfs=/host/proc' - '--path.sysfs=/host/sys' - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)' ports: - 9100:9100 networks: - prometheus-net restart: always # deploy: # mode: global networks: traefik-net: external: true name: traefik-net prometheus-net: name: prometheus-net external: true
Menjalankan docker node-exporter dengan menjalankan perintah docker compose up -d . didalam directory node-exporter
docker compose up -d .
Tampilan metrik node exporter