percona / mongodb_exporter

A Prometheus exporter for MongoDB including sharding, replication and storage engines
Apache License 2.0
1.15k stars 426 forks source link

SRV with direct connect #773

Open ariksidney opened 7 months ago

ariksidney commented 7 months ago

Is your feature request related to a problem? Please describe. We're using Atlas on AWS with a private endpoint. When I try to run the exporter with the srv connection string, I cannot connect to the MongoDB cluster. However if use a non srv connection string (with all the replica set nodes in it) and use --mongodb.direct-connect, the connection works without any issues.

Describe the solution you'd like A solution would be to resolve the srv dns entry if the --mongodb.direct-connect option is set and the uri is a srv connection string. A new exporter would then be created for each replica.

Describe alternatives you've considered The easiest alternative would be to just use the replica nodes uri instead of the srv connection string. However we currently only have the srv connection string in our configMaps.

Additional context If you think this feature would be helpful for the project, I would gladly contribute it.