Scraping, querying, and visualizing Prometheus metrics

Prometheus server is designed to pull the metrics from instrumented services. However, since we wanted to avoid unnecessary coupling, we used exporters that provide the metrics we need. Those exporters are already running as Swarm services, and now we are ready to exploit them through Prometheus. To instantiate the Prometheus service, we should create a configuration file with the exporters running in our cluster. Before we do that, we need to retrieve the IPs of all the instances of an exporter service. If you recall the Chapter 4Service Discovery inside a Swarm Cluster, we can retrieve all the IPs by appending the tasks. prefix to the service name.

To retrieve the list of all the ...

Get The DevOps 2.1 Toolkit: Docker Swarm now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.