Exploring Swarm & Container Overview Dashboard in Grafana

In my previous post, your learnt how to monitor your Swarm Cluster with TICK Stack. In this part, I will show you how to use the same Stack but instead of using Chronograf as our visualization and exploration tool we will use Grafana.

Connect to your manager node via SSH, and clone the following GitHub repository:

1
git clone https://github.com/mlabouardy/swarm-tig.git

Use the docker-compose.yml below to setup the monitoring stack:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
version: "3.3"

services:
telegraf:
image: telegraf:1.3
networks:
- tig-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
configs:
- source: telegraf-config
target: /etc/telegraf/telegraf.conf
deploy:
restart_policy:
condition: on-failure
mode: global

influxdb:
image: influxdb:1.2
networks:
- tig-net
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.role == worker

grafana:
container_name: grafana
image: grafana/grafana:4.3.2
ports:
- "3000:3000"
networks:
- tig-net
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.role == manager

configs:
telegraf-config:
file: $PWD/conf/telegraf/telegraf.conf

networks:
tig-net:
driver: overlay

Then, issue the following command to deploy the stack:

1
docker stack deploy --compose-file docker-compose.yml tig

Once deployed, you should see the list of services running on the cluster:



Point your browser to http://IP:3000, you should be able to reach the Grafana Dashboard:



The default username & password are admin. Go ahead and log in.

Go to “Data Sources” and create 2 InfluxDB data sources:

  • Vms: pointing to your Cluster Nodes metrics database.
  • Docker: pointing to your Docker Services metrics database.


Finally, import the dashboard by hitting the “import” button:



From here, you can upload the dashboard.json, then pick the data sources you created earlier:



You will end up with an interactive and dynamic dashboard:



Drop your comments, feedback, or suggestions below — or connect with me directly on Twitter @mlabouardy.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×