【问题标题】:MongoDB workingSet by pymongoMongoDB workingSet 由 pymongo
【发布时间】:2013-09-10 15:08:30
【问题描述】:

我尝试使用 pymongo 获取“workingSet”指标。在 MongoDB 中只是 db.runCommand( { serverStatus: 1, workingSet: 1 } )。我在 python 中试过了

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

我的方法不起作用。它的输出不是任何“workingSet”指标。

知道如何在 python 中以编程方式获取这些指标吗?

【问题讨论】:

    标签: python mongodb metrics


    【解决方案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}
    

    【讨论】:

      猜你喜欢
      • 2022-11-04
      • 2010-12-17
      • 2022-01-14
      • 2017-09-27
      • 2013-11-24
      • 2017-11-01
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      相关资源
      最近更新 更多