Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB workingSet by pymongo

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?

like image 925
burseaner Avatar asked Dec 11 '25 08:12

burseaner


1 Answers

>>> 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}
like image 199
jeffl Avatar answered Dec 13 '25 01:12

jeffl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!