Now that all the Prometheus endpoints are prepared, we can now proceed with collecting these metrics in Prometheus itself. Afterwards, we will run Grafana to visualize all of the metrics that we have exposed in the previous subsection.
The following steps will deploy Prometheus as a service in our Docker Swarm cluster:
- First, let's prepare a service config for Prometheus in a file called prometheus.yml, as follows:
---global: scrape_interval: 15sscrape_configs: - job_name: cadvisor dns_sd_configs: - names: - 'tasks.cadvisor' type: A port: 8080 - job_name: docker static_configs: - targets: - dockerhost:1337 - node1:1337
In the preceding configuration, we scraped each Docker Engine in our Docker Swarm cluster ...