'Make the call to mongo host and collect the blocking data'

def _collectStats(self, passes, monitorConn):

    root = {}
    root['agentVersion'] = self.mmsAgent.agentVersion
    root['agentHostname'] = self.mmsAgent.agentHostname
    isMaster = monitorConn.admin.command('ismaster')
    root['isMaster'] = isMaster
    isMongos = (('msg' in isMaster) and (isMaster['msg'] == 'isdbgrid'))
    try:
        if ((isMaster['ismaster'] == True) and isMongos):
            root['shards'] = list(monitorConn.config.shards.find())
            try:
                root['locks'] = list(monitorConn.config.locks.find(limit=200, sort=[('$natural', pymongo.DESCENDING)]))
            except Exception as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, 'config.locks.find', e)
            try:
                if self.mmsAgent.settings.configCollectionsEnabled:
                    root['configCollections'] = list(monitorConn.config.collections.find(limit=200, sort=[('$natural', pymongo.DESCENDING)]))
            except Exception as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, 'config.collections.find', e)
            try:
                if self.mmsAgent.settings.configDatabasesEnabled:
                    root['configDatabases'] = list(monitorConn.config.databases.find(limit=200, sort=[('$natural', pymongo.DESCENDING)]))
            except Exception as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, 'config.databases.find', e)
            try:
                root['configLockpings'] = list(monitorConn.config.lockpings.find(limit=200, sort=[('$natural', pymongo.DESCENDING)]))
            except Exception as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, 'config.lockpings.find', e)
            queryTime = (datetime.datetime.utcnow() - datetime.timedelta(seconds=1200))
            root['mongoses'] = list(monitorConn.config.mongos.find({'ping': {'$gte': queryTime}}).limit(1000))
            shardChunkCounts = []
            positions = {}
            counter = 0
            if ((passes % 10) == 0):
                for chunk in monitorConn.config.chunks.find():
                    key = (chunk['ns'] + chunk['shard'])
                    if (key not in positions):
                        count = {}
                        positions[key] = counter
                        shardChunkCounts.append(count)
                        counter = (counter + 1)
                        count['count'] = 0
                        count['ns'] = chunk['ns']
                        count['shard'] = chunk['shard']
                    shardChunkCounts[positions[key]]['count'] = (shardChunkCounts[positions[key]]['count'] + 1)
                root['shardChunkCounts'] = shardChunkCounts
    except pymongo.errors.OperationFailure:
        pass
    root['serverStatus'] = monitorConn.admin.command('serverStatus')
    isReplSet = False
    isArbiter = False
    if ('repl' in root['serverStatus']):
        try:
            root['replStatus'] = monitorConn.admin.command('replSetGetStatus')
            if (root['replStatus']['myState'] == 7):
                isArbiter = True
            isReplSet = True
        except pymongo.errors.OperationFailure:
            pass
        if isReplSet:
            oplog = 'oplog.rs'
        else:
            oplog = 'oplog.$main'
        try:
            root['localSystemReplSet'] = monitorConn.local.system.replset.find_one()
        except pymongo.errors.OperationFailure as e:
            self.mmsAgent.handleOperationFailure(self.hostKey, 'local.system.replset.findOne', e)
        localConn = monitorConn.local
        oplogStats = {}
        if isArbiter:
            pass
        elif ((isMaster['ismaster'] == True) or isReplSet):
            try:
                oplogStats['start'] = localConn[oplog].find(limit=1, sort=[('$natural', pymongo.ASCENDING)], fields={'ts': 1})[0]['ts']
                oplogStats['end'] = localConn[oplog].find(limit=1, sort=[('$natural', pymongo.DESCENDING)], fields={'ts': 1})[0]['ts']
                oplogStats['rsStats'] = localConn.command({'collstats': 'oplog.rs'})
            except pymongo.errors.OperationFailure as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, (('local.' + oplog) + '.find'), e)
        else:
            try:
                oplogStats['sources'] = {}
                for s in localConn.sources.find():
                    oplogStats['sources'][s['host']] = s
            except pymongo.errors.OperationFailure as e:
                self.mmsAgent.handleOperationFailure(self.hostKey, 'local.sources.find', e)
        root['oplog'] = oplogStats
    if (not isArbiter):
        try:
            root['configSettings'] = list(monitorConn.config.settings.find())
        except Exception as e:
            self.mmsAgent.handleOperationFailure(self.hostKey, 'config.settings.find', e)
    root['databases'] = {}
    root['dbProfiling'] = {}
    root['dbProfileData'] = {}
    profilerEnabled = self.mmsAgent.hostDefValue(self.hostKey, 'profiler')
    if ((((passes % 20) == 0) or profilerEnabled) and (not isArbiter) and (not isMongos)):
        count = 0
        for x in monitorConn.database_names():
            try:
                if ((passes % 20) == 0):
                    if (self.slowDbStats and ((time.time() - self.lastDbStatsCheck) < 7200)):
                        continue
                    if (not self.mmsAgent.disableDbstats):
                        count += 1
                        if (count > 100):
                            break
                        startTime = time.time()
                        temp = monitorConn[x].command('dbstats')
                        for f in temp:
                            if (isinstance(temp[f], (int, long, float, complex)) and (str(temp[f]) == '-inf')):
                                temp[f] = 0
                        root['databases'][x] = temp
                        if ((time.time() - startTime) > 6):
                            self.slowDbStats = True
                        else:
                            self.slowDbStats = False
                        self.lastDbStatsCheck = time.time()
                if (profilerEnabled and (not isArbiter) and (not self.mmsAgent.settings.disableProfileDataCollection)):
                    try:
                        profileData = list(monitorConn[x].system.profile.find(spec=None, fields=None, skip=0, limit=20, sort=[('$natural', pymongo.DESCENDING)]))
                        if (len(profileData) > 0):
                            root['dbProfileData'][x] = profileData
                    except Exception as e:
                        self.mmsAgent.handleOperationFailure(self.hostKey, ('system.profile.find-' + x), e)
                try:
                    profiling = monitorConn[x].command({'profile': (-1)})
                    if ((profiling is not None) and ('ok' in profiling)):
                        del profiling['ok']
                    root['dbProfiling'][x] = profiling
                except Exception:
                    pass
            except:
                continue
    if ('serverStatus' in root):
        del root['serverStatus']
    return root
