简体   繁体   中英

monitoring agent can't connect to replica set with auth enabled

I have a replica set with auth enabled. All members are able to authenticate to each other with internal authentication (keyfile) and replication is working fine. I installed a monitoring agent in one of the mebers and it connects to mongo cloud.

The problem is that the monitoring agent is not able to authenticate to the replica set. I know that because mongo cloud shows a warning.

A Monitoring Agent was unable to establish a connection to this host because of an authentication error. Please check the monitoring agent log for details.

And the logs say:

Error: Failure during discovery.

I know it is not a discovery issue because if I start the replica set without auth enabled then mongo cloud shows everything normal.

Question

What I need to know is how to tell the monitoring agent what user and password to use to authenticate to the replica set. I looked through the documentation but I couldn't find it. However I did find this:

If your MongoDB deployment enforces access control, the Cloud Manager Monitoring Agent must authenticate to MongoDB as a user with the proper access.

https://docs.cloudmanager.mongodb.com/reference/required-access-monitoring-agent/

I can create the user with the correct roles but it doesn't say how to configure the monitoring agent to use that user and password.

After looking some more in the documentation I was finally able to find the way to do it, but I am not 100% convinced this is the correct way because the documentation marks this section as deprecated, but I can't find anything else on this subject.

You can edit the configuration file for the monitoring agent and add these two options to specify user and password that it will use:

/etc/mongodb-mms/monitoring-agent.config

globalAuthUsername=mms-monitoring-agent
globalAuthPassword=password

https://docs.cloudmanager.mongodb.com/reference/monitoring-agent/#msetting.globalAuthUsername

After editing the file restart the monitoring agent.

EDIT:

I was not using the automation agent that is why I needed to do it manually. If you are using the automation agent then this can be done through the UI in mongo cloud.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM