Antony Dao
Antony Dao

Reputation: 425

How to get number of connections to MongoDB when auth=true

MongoDB version 2.4.5

I enabled auth=true in mongodb.conf, then I cannot use db.serverStatus() or mongostat.exe to get number of connection to MongoDB. They are defect of MongoDB (https://jira.mongodb.org/browse/SERVER-4977 and https://github.com/DataDog/dd-agent/issues/318 )

My question is: Are there any way to get number of connections to MongoDB if auth=true?

Upvotes: 1

Views: 525

Answers (1)

Stennie
Stennie

Reputation: 65323

The Jira issue you linked (SERVER-4977) is referring to the mongostat tool and isn't relevant to whether you can call the serverStatus command from your own application code or the mongo shell if properly authenticated.

If you have enabled authentication in MongoDB 2.4, the serverStatus command requires an authenticated user with the clusterAdmin role.

Authentication as at MongoDB 2.4 is enabled at the server level, so once enabled all connections will need to be authenticated using appropriate users & roles.

Upvotes: 1

Related Questions