MongoDB workingSet by pymongo

删除回忆录丶 提交于 2019-12-01 06:36:13

问题


I try to get "workingSet" metrics with pymongo. In MongoDB is just db.runCommand( { serverStatus: 1, workingSet: 1 } ). I've tried in python

from pymongo.mongo_client import MongoClient
connection = MongoClient('localhost', 27017)
db = connection['admin']
workingSetMetrics = db.command("serverStatus", "workingSet")
print 'workingSetMetrics: ', workingSetMetrics

My approach doesn't work. It the output isn't any "workingSet" metrics.

Any idea how i can get those metrics programmatically in python?


回答1:


>>> import pymongo
>>> c = pymongo.MongoClient()
>>> c['admin'].command('serverStatus', workingSet=True)['workingSet']
{u'note': u'thisIsAnEstimate', u'computationTimeMicros': 4555, u'pagesInMemory': 7, u'overSeconds': 388}


来源:https://stackoverflow.com/questions/18722547/mongodb-workingset-by-pymongo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!