Connecting to MongoDB ReplicaSet

@Gnubesoft hey :wave:

Correct me if I am wrong - ReplicaSet is a primary/secondary (or secondaries) setup. You have several MongoDB instances running on different servers.

Netdata Agent supposed to be installed on every host and gather data from the system and applications running on the server.

It also possible to collect data from remote applications, our external plugins (python.d, go.d) are able to do it.

That is a very nice article that provides the details on the subject. Consider checking it :slightly_smiling_face:

So if you want to monitor several MongoDB instances:

  • (1) install Netdata on every server and collect metrics for local instances (preferred)
  • (2) or install Netdata on one server and collect metrics from local and remote instances

In case 2 you need to create a separate job for every instance in the python.d/mongodb.conf.


You are correct, we are using pymongo library and it supports connecting via MongoDB URI or separate parameters (host, port, ssl, etc.). Our mongodb collector doesn’t MongoDB URI option, unfortunately (i think we never had a request to implement that).

All the supported configuration options can be found in the configuration file itself.

That is an example of a configuration file with 3 jobs, one local and 2 remote:

local:
    authdb: 'admin'
    host : '127.0.0.1'
    port : 27017
    user : 'netdata'
    pass : 'netdata'

remote1:
    authdb: 'admin'
    host : '192.0.2.1'
    port : 27017
    user : 'netdata'
    pass : 'netdata'

remote2:
    authdb: 'admin'
    host : '192.0.2.2'
    port : 27017
    user : 'netdata'
    pass : 'netdata'