- Create the monitor network
docker network create monitor
- Run cAdvisor container
docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
--network=monitor \
gcr.io/cadvisor/cadvisor:latest
- cAdvisor is now available at
localhost:8080
- Write the prometheus.yml config file (already written)
- Run Prometheus container (change /path/to/prometheus.yml to the path to your Prometheus config file)
docker run -d \
-p 9090:9090 \
--name=prometheus \
-v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml \
--network monitor \
prom/prometheus
- Prometheus is now available at
localhost:9090
- Run Grafana container
docker run -d -p 3000:3000 --name=grafana --network=monitor grafana/grafana
- Grafana is now available at
localhost:3000
- Enter default credentials (admin/admin)
- Add Prometheus as a data source
- Go to "Connections" tab
- "View configured data sources"
- "Add data source" > "Prometheus"
- Enter address of Prometheus container (
http://prometheus:9090)
- Make a dashboard
- Go to "Dashboards" tab
- Click "Create dashboard"
- "Add visualisation"
- Select "prometheus" as data source
- Choose some metric in the "Metric" field
- Save the dashboard