mongodb_exporter icon indicating copy to clipboard operation
mongodb_exporter copied to clipboard

Serving SRV targets and getting all nodes in single request

Open adnull opened this issue 10 months ago • 0 comments

As it stated in https://github.com/percona/mongodb_exporter/issues/773 there is no chance to monitor cluster nodes with the only mongodb+srv url specified. According to the specification, direct connection couldn't be used with a cluster, specified as a SRV domain

This update adds

  • --split-cluster option, which:
    • extracts mongodb+srv domain into cluster connection string containing nodes from DNS server
    • splits all cluster connection string into separate targets that can be queried by "target" parameter of multitarget endpoint
  • overall target endpoint "/scrapeall" which outputs all the targets metrics with a "instance" label containing nodename as a host:port pair (or only host if no port specified)

Combining all that features we can specify cluster url as mongodb+srv domain and monitor all the nodes metrics and states in one request by querying /scrapeall endpoint

adnull avatar Apr 03 '24 19:04 adnull