Skip to content

Instantly share code, notes, and snippets.

@whizyrel
Last active February 3, 2025 21:28
Show Gist options
  • Select an option

  • Save whizyrel/f58c43a6c892eeeb39c4f093faa616a1 to your computer and use it in GitHub Desktop.

Select an option

Save whizyrel/f58c43a6c892eeeb39c4f093faa616a1 to your computer and use it in GitHub Desktop.
version: '3.3'
volumes:
prometheus-data:
driver: local
grafana-data:
driver: local
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
volumes:
- ./config:/etc/prometheus/
- prometheus-data:/prometheus
networks:
- prometheus-network
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
volumes:
- grafana-data:/var/lib/grafana
networks:
- prometheus-network
ports:
- "3000:3000"
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
pid: host
ports:
- "9100:9100"
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
networks:
- prometheus-network
networks:
prometheus-network:
driver: bridge
version: '3.3'
services:
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
pid: host
ports:
- "9100:9100"
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
networks:
- prometheus-network
networks:
prometheus-network:
driver: bridge
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['node_exporter:9100']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment