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.

Revisions

  1. whizyrel revised this gist Feb 3, 2025. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions prometheus.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # 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']
  2. whizyrel revised this gist Feb 2, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-exporter-docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,6 @@ services:
    - '/:/host:ro,rslave'
    networks:
    - prometheus-network
    networks:
    networks:
    prometheus-network:
    driver: bridge
  3. whizyrel revised this gist Jan 28, 2025. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions node-exporter-docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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
  4. whizyrel renamed this gist Jan 26, 2025. 1 changed file with 0 additions and 0 deletions.
  5. whizyrel created this gist Jan 26, 2025.
    44 changes: 44 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    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