Skip to content

Document running exporter with --no-mongodb.direct-connect and multiple mongo servers in uri #971

Open
@bareksml

Description

@bareksml

Describe the bug

There is no mongodb_exporter deployment pattern for clusters provided in documentation. I can run my exporter on HA platform and i want to get cluster state. For that reason i have tried:

mongodb_exporter --mongodb.uri="mongodb://10.0.3.222:27017,10.0.1.210:27017,10.0.2.101:27017/?replicaSet=rs0"  --collect-all

Result is:

ERRO[0000] Cannot connect to MongoDB: invalid MongoDB options: a direct connection cannot be made if multiple hosts are specified

I can get single exporter process working with my cluster by using --no-mongodb.direct-connect. Some posts from Percona guys suggests we should have one exporter per node. This would complicate scraping and later on i will have metrics tripled (extra dimension being particular exporter). This is kind of dirty so it would be great to have some information about the deployment pattern. Also answer for a qestion:

Can i run with multiple cluster nodes and --no-mongodb.direct-connect without risk of having broken metrics?

To Reproduce
Steps to reproduce the behavior:
Try running exporter against 3 node replicaset cluster.

Expected behavior
Answer provided and documentation updated.

Environment

  • Linux
  • mixed
  • MongoDB 4.x however i feel question is quite generic

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions