--- title: node_exporter+Prometheus+grafana date: 2024-12-07T17:40:00+08:00 lastmod: 2024-12-07T17:40:34+08:00 --- # node_exporter+Prometheus+grafana ```yaml version: '3.8' services: node_exporter: image: prom/node-exporter:latest container_name: node_exporter restart: unless-stopped networks: - monitoring command: - '--path.rootfs=/host' pid: host volumes: - '/:/host:ro,rslave' prometheus: image: prom/prometheus:latest container_name: prometheus restart: unless-stopped networks: - monitoring volumes: - ./prometheus:/etc/prometheus - ./data/prometheus:/prometheus command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--web.console.libraries=/usr/share/prometheus/console_libraries' - '--web.console.templates=/usr/share/prometheus/consoles' grafana: image: grafana/grafana:latest container_name: grafana restart: unless-stopped networks: - monitoring ports: - "3081:3000" volumes: - ./data/grafana:/var/lib/grafana environment: - GF_SECURITY_ADMIN_PASSWORD=admin123 networks: monitoring: driver: bridge ```