Prometheus.io docs describe how to use Docker Swarm service discovery with 
a label

docker service create \
  --name cadvisor \
  --label prometheus-job=cadvisor \
  ... 

You find the corresponding prometheus.yml at 
https://prometheus.io/docs/guides/dockerswarm/

This might work with an explicit prometheus exporter container which 
exposes a single metrics port, but this does not work for a real 
application like the Traefik Proxy server, which exposes ports 80 and 443, 
but metrics are available at port 8082.

The challenges I found: 
1. Prometheus automatically discovers two targets (ports 80 and 443)
2. Prometheus does not know about the correct metrics port (8082)

Is it possible to use Docker Swarm Service Discovery with relabeling to 
reduce the targets to a single one per container and update the port by 
just adding a second label for the correct port?

docker service create \
  --name traefik \
  --label prometheus-job=traefik \
  --label prometheus-port=8082 \
  ...


-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/eea8be68-ff8b-4160-83ff-8d778f5c84b9n%40googlegroups.com.

Reply via email to