Skip to content

Instantly share code, notes, and snippets.

@Azaferany
Forked from aRmanNM/docker-compose.yml
Created March 13, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Azaferany/0546dee70b135b17daa5a8dc23fe3f1f to your computer and use it in GitHub Desktop.
Save Azaferany/0546dee70b135b17daa5a8dc23fe3f1f to your computer and use it in GitHub Desktop.
grafana + prometheus + node_exporter
version: '3.8'
networks:
monitoring:
driver: bridge
volumes:
prometheus_data: {}
grafana_data: {}
services:
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
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)($$|/)'
expose:
- 9100
networks:
- monitoring
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
expose:
- 9090
networks:
- monitoring
grafana:
image: grafana/grafana-oss
container_name: grafana
ports:
- 3000:3000
volumes:
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- grafana_data:/var/lib/grafana
networks:
- monitoring
global:
scrape_interval: 1m
scrape_configs:
- job_name: "prometheus"
scrape_interval: 1m
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["node-exporter:9100"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment