Skip to content

Instantly share code, notes, and snippets.

@zettalyst
Created June 26, 2024 06:34
Show Gist options
  • Select an option

  • Save zettalyst/ba0d970c1ff9da052718548710b6369b to your computer and use it in GitHub Desktop.

Select an option

Save zettalyst/ba0d970c1ff9da052718548710b6369b to your computer and use it in GitHub Desktop.
docker-compose: grafana, prometheus, node_exporter
services:
prometheus:
image: prom/prometheus:v2.52.0
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- '9090:9090'
node_exporter:
image: prom/node-exporter:v1.8.0
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)($$|/)'
ports:
- '9100:9100'
grafana:
image: grafana/grafana-oss:10.4.2
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin # Set the admin password
- GF_USERS_ALLOW_SIGN_UP=false
ports:
- '3000:3000'
depends_on:
- prometheus
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus' # prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: 'node' # node_exporter
static_configs:
- targets: ['node_exporter:9100']
@zettalyst
Copy link
Author

$ docker-compose up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment