Skip to content

Instantly share code, notes, and snippets.

@atty303
Created November 10, 2016 09:11
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 atty303/80d0ce73f310b9a98a66f0720339a4cf to your computer and use it in GitHub Desktop.
Save atty303/80d0ce73f310b9a98a66f0720339a4cf to your computer and use it in GitHub Desktop.
Promethes & Grafana - Quick Start

手元で素早く Prometheus & Grafana を立ち上げます。 Grafana への DataSource 登録も自動でやるので、すぐに使えます。 Prometheus Exporter の出力の確認にどうぞ。

起動

$ docker-compose up -d
Creating network "ezprometheus_default" with the default driver
Creating ezprometheus_prometheus_1
Creating ezprometheus_grafana_1
Creating ezprometheus_register_datasource_1

終了

$ docker-compose down

アクセス

version: '2'
services:
prometheus:
image: prom/prometheus:v1.3.1
ports:
- '9090:9090'
volumes:
- .:/mnt/prometheus
command: >
-config.file=/mnt/prometheus/prometheus.yml
-storage.local.path=/prometheus
-web.console.libraries=/etc/prometheus/console_libraries
-web.console.templates=/etc/prometheus/consoles
grafana:
image: grafana/grafana:3.1.1
ports:
- '3000:3000'
links:
- prometheus
register_datasource:
image: mwendler/wget
command: >
wget -O - --retry-connrefused --tries 20
--header 'Content-Type: application/json'
--post-data '{"name":"Prometheus", "type":"prometheus", "url":"http://prometheus:9090/", "access":"proxy", "isDefault":true}'
--http-user=admin --http-password=admin --auth-no-challenge
http://grafana:3000/api/datasources
links:
- grafana
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'some-target'
static_configs:
- targets: ['localhost:12345'] # このへん変える
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment