├── prometheus.yml
├── README.md
└── docker-compose.yml
/prometheus.yml:
--------------------------------------------------------------------------------
1 | #prometheus.yml - file
2 | #this must be in the same directory as of docker-compose.yml file
3 |
4 | scrape_configs:
5 | - job_name: cadvisor
6 | scrape_interval: 5s
7 | static_configs:
8 | - targets:
9 | - cadvisor:8080
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # docker-monitoring
2 | monitoring docker containers using cadvisor, prometheus,redis and grafana
3 | # run - docker-compose up
4 | if everything is working good, you should see this message
5 | msg="Server is ready to receive web requests."
6 | check three containers are running using docker-compose ps
7 | # accessing cadvisor
8 | http://localhost:8080
9 | # accessing prometheus
10 | http://localhost:9090
11 | # running grafana on docker host
12 | docker run -d --name grafana -p 3000:3000 grafana/grafana
13 | Access grafana using
14 | http://localhost:3000
15 | # configure grafana to use prometheus as data source
16 |
17 |
18 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | #first create a folder - mkdir ~/docker-prometheus
2 | #create a file - docker-compose.yml inside it with the following contents
3 | #you also need to copy prometheus.yml file inside the same directory
4 |
5 | version: '3.2'
6 | services:
7 | prometheus:
8 | image: prom/prometheus:latest
9 | container_name: prometheus
10 | ports:
11 | - 9090:9090
12 | command:
13 | - --config.file=/etc/prometheus/prometheus.yml
14 | volumes:
15 | - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
16 | depends_on:
17 | - cadvisor
18 | cadvisor:
19 | image: gcr.io/google-containers/cadvisor:latest
20 | container_name: cadvisor
21 | ports:
22 | - 8080:8080
23 | volumes:
24 | - /:/rootfs:ro
25 | - /var/run:/var/run:rw
26 | - /sys:/sys:ro
27 | - /var/lib/docker/:/var/lib/docker:ro
28 | depends_on:
29 | - redis
30 | redis:
31 | image: redis:latest
32 | container_name: redis
33 | ports:
34 | - 6379:6379
35 |
--------------------------------------------------------------------------------