Error retrieving database names from Mongo instance: command listDatabases requires authentication

I am trying to integrate elastic-agent in MongoDB replica-set and show mongo metrics on kibana , while trying with below code on mongo.conf

security:
   authorization: enabled
   keyFile: /etc/keyfile

MongoDb version using is 5.0

when security auth is Enabled facing below issue connecting mongo to Elasticsearch .

Dec 2, 2021 @ 10:56:11.711 Error retrieving database names from Mongo instance: command listDatabases requires authentication

Dec 2, 2021 @ 10:56:11.710 Error retrieving collection totals from Mongo instance: command top requires authentication

Dec 2, 2021 @ 10:56:11.710 failed to retrieve serverStatus: command serverStatus requires authentication

Dec 2, 2021 @ 10:56:11.710 error getting replication info: command listCollections requires authentication

Dec 2, 2021 @ 10:56:11.710 failed to retrieve serverStatus: command serverStatus requires authentication

Please find the error Image here

Please help if you have any hints to resolve this issue .

Thanks in advance !

Yes - this is frustrating.

Agent installs, mongodb integrates -- and the docs tell you how to add a mongodb user/password.

But, there is NOTHING documented on how to configure the agent integration to actually use a username + password when it connects to the mongodb.

come on, Elastic ... answer this dude's question.

--edit --
Looks like, if you dig around: check your policy for the agent, then the mongodb integration line. You should have some enabled "collect" functions, listed in rows, each with a triangle dropdown on the far right.

Oh ... somewhere in there, you need to click Advanced Settings link to open up the absolutely long list of configuration options for that function of the integration.

Keep going ... check each one of those, scrolling down until you stumble across the username and password form fields.

Lord! please document this common configuration steps or move the most obvious ones (like user/password that you documented to actually do), up to the initial integration-addition steps. ...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.