doc.dev1x.org

Prometheus

概要

PrometheusをDockerで動かしてみる

コンテナ作成

docker-compose.yaml

version: '3.7'
services:
    prometheus:
        image: prom/prometheus
        container_name: prometheus
        volumes:
            - ./prometheus.yml:/etc/prometheus/prometheus.yml
        ports:
            - 9090:9090
    node-exporter:
        container_name: node-exporter
        image: prom/node-exporter
        ports:
            - 9100:9100

prometheus.yml

global:
  scrape_interval: 15s
  external_labels:
    monitor: 'codelab-monitor'

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'node'
    scrape_interval: 5s
    static_configs:
      - targets: ['node-exporter:9100']

コンテナ起動

docker-compose up -d

参考資料