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 4, Service 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 replicas of the node-exporter service, we could, for example, drill it from one of the instances of the util service:
docker exec -it $UTIL_ID \
drill tasks.node-exporter...