Search code examples
mongodbauthenticationmonitoringdatabase-replicationsharding

MongoDB Monitoring Service Authentication


I have a sharded cluster of mongodb, 2 shards, each shard is a 3 server replica set. all servers are in a aws-vpc and with keyFile without auth option, only the mongos server have an ip and external access and it have the auth option. i installed the 10gen MMS service on the mongos server and its identified all my servers but it starting to throw errors to the log:

Problem collecting blocking data from (check if it is up and DNS): 10.0.1.150:27017 -
exception: Traceback (most recent call last): File "/root/mms-agent/blockingStats.py",
line 81, in _collectBlockingStats stats = self._collectStats( passes, monitorConn ) File
"/root/mms-agent/blockingStats.py", line 175, in _collectStats root['serverStatus'] = 
monitorConn.admin.command( 'serverStatus' ) File "/usr/lib/python2.6/site-
packages/pymongo-2.5.2-py2.6-linux-x86_64.egg/pymongo/database.py", line 393, in
command msg, allowable_errors) File "/usr/lib/python2.6/site-packages/
pymongo-2.5.2-py2.6-linux-x86_64.egg/pymongo/helpers.py", line 147, in 
_check_command_response raise 
OperationFailure(msg % errmsg, code) OperationFailure: command SON([('serverStatus', 1)]) 
failed: unauthorized

i tried to add the

globalAuthUsername = """MY_USER"""

globalAuthPassword = """MY_PASS"""

but it still throws this error, a little different

Problem collecting blocking data from: 10.0.1.150:27017 - exception: Traceback (most 
recent call last): File "/root/mms-agent/blockingStats.py", line 57, in run monitorConn = 
self.mmsAgent.getDbConnection( self.hostKey ) File "/root/mms-agent/mmsAgent.py",
line    107,
in getDbConnection return pymongo.Connection( hostDef['mongoUri'] , slave_okay=True, 
document_class=bson.son.SON ) File "/usr/lib/python2.6/site-packages/pymongo-2.5.2-py2.6-
linux-x86_64.egg/pymongo/connection.py", line 220, in __init__ max_pool_size, 
document_class, 
tz_aware, _connect, **kwargs) File "/usr/lib/python2.6/site-packages/pymongo-2.5.2-py2.6-
linux-x86_64.egg/pymongo/mongo_client.py", line 355, in __init__ raise 
ConfigurationError(str(exc)) ConfigurationError: command SON([('authenticate', 1),
('user', u'root'), ('nonce', u'523396ae8ef27d70'), ('key',
u'ce27e3fa05186bd1b7d3594cd3efb00f')]) failed: auth fails

any ideas?


Solution

  • Found the answer... All instances must have username and pass authentication