Deploying Docker Flow Monitor is easy (as almost all Docker services are). We'll start by creating a network called monitor. We could let Docker stack create it for us, but it is useful to have it defined externally so that we can easily attach it to services from other stacks:
The environment variable GLOBAL_SCRAPE_INTERVAL shows the first improvement over the "original" Prometheus service. It allows us to define entries of its configuration as environment variables. That, in itself, is not a significant improvement but is a good start. More powerful additions will be explored later on.
Please wait a few moments until Swarm pulls the image and starts the service. You can monitor the status by executing docker stack ps monitor command.
Once the service is running, we can confirm that the environment variable indeed generated the configuration:
open "http://$(docker-machine ip swarm-1):9090/config"
Figure 3-6: Prometheus configuration defined through environment variables
Please note that you do not have to use Docker Flow Monitor to accomplish the same Prometheus configuration. We are using it mostly as a fast and dynamic way to configure it. You can choose to do the same by changing its configuration manually.
We are going to expose services url in pretty format, therefore we must get rid of port number (9090) in preceding url.