Collect metrics from Docker Host:
docker run -d -p 9104:9104 -v /sys/fs/cgroup:/cgroup -v /var/run/docker.sock:/var/run/docker.sock prom/container-exporter
Server:
docker run -d --name prometheus-server -p 9093:9090 -v $PWD/prometheus.conf:/prometheus.conf prom/prometheus -config.file=/prometheus.conf
cat prometheus.conf
global:
scrape_interval: 15s
evaluation_interval: 15s
labels:
monitor: exporter-metrics
rule_files:
scrape_configs:
- job_name: prometheus
scrape_interval: 5s
static_configs:
# These endpoints are scraped via HTTP.
- targets: ['localhost:9090']
labels:
group: 'prometh'
- job_name: vp-ext127
scrape_interval: 5s
static_configs:
# These endpoints are scraped via HTTP.
- targets: ['10.120.167.127:9104']
labels:
group: 'vp-ext127'
Query: rate(prometheus_local_storage_chunk_ops_total[1m])
Dashboard:
docker run -p 3306:3306 --name promdash-mysql \
-e MYSQL_DATABASE=promdash-db \
-e MYSQL_USER=prometheus \
-e MYSQL_PASSWORD=prometh3us \
-e MYSQL_ROOT_PASSWORD=fr332try \
-d mysql
# Initialize Database
docker run --rm -it --link promdash-mysql:db -e DATABASE_URL=mysql2://prometheus:prometh3us@db:3306/promdash-db prom/promdash ./bin/rake db:migrate
# Run Dashboard
docker run -d --link promdash-mysql:db -p 3000:3000 --name prometheus-dash -e DATABASE_URL=mysql2://prometheus:prometh3us@db:3306/promdash-db prom/promdash
Reference: