Domanda

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?

È stato utile?

Soluzione

>>> 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}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top