How to remove duplicate scrape targets from service discovery?

590 views
Skip to first unread message

Mike B.

unread,
Aug 18, 2022, 5:40:02 AM8/18/22
to Prometheus Users
We are using Docker Swarm Service Discovery to find Prometheus targets. With help of an old post we managed to overwrite the port of the discovered targets when we add a prometheus-port label to the service (https://groups.google.com/g/prometheus-users/c/4Hr4e4vaVMQ).

Our problem is Traefik, the image exposes two ports (80, 443), but not the Prometheus port 8082. I can overwrite the port with a label now, but service discovery created two targets for Prometheus already.

Is it possible to use relabelling to remove a target that is discovered twice, make the targets unique/distinct? First dockerswarm_sd_configs delivers the two targets with same host and different port, after the port relabel step both targets have the same __address__.

The log is filling up fast with messages stating "skipping duplicate scrape target with identical labels", I would like to avoid that by just removing the duplicate scrape targets.




Reply all
Reply to author
Forward
0 new messages