用于导出器的度量列表
statsmetrics的Python项目详细描述
此模块包含可用于导出到分析应用程序的度量。
安装说明:
通过pip:
安装$ pip install statsmetrics
请参见http://www.pip-installer.org/en/latest/installing.html
可用指标:
- Couchbase
用法示例:
from statsmetrics import couchbase as couchbasemetrics metrics = couchbasemetrics.get_metrics()
响应格式:
'cluster': { 'url': '/pools/default/', 'metrics': [ {'name':'storageTotals.ram.total','id':'storageTotals.ram.total','suffix':'bytes','labels':['name']}, (... other cluster metrics) ] }, 'nodes': { 'url': '/pools/nodes/', 'metrics': [ {'name':'systemStats.cpu_utilization_rate','id':'systemStats.cpu_utilization_rate','suffix':'count','labels':['name','hostname']}, (... other nodes metrics) ] }, 'buckets': { 'url': '/pools/default/buckets/', 'metrics': [ {'name':'basicStats.quotaPercentUsed','id':'basicStats.quotaPercentUsed','suffix':'percent','labels':['name','bucket']}, (... other buckets metrics), ], 'bucket_stats': [ {'name':'avg_bg_wait_time','id':'avg_bg_wait_time','suffix':'seconds','labels':['name','bucket']}, (... other bucket_stats metrics), ] } }
测试包:
$ python test.py
提示:
将返回的数据转换为json格式
import json from statsmetrics import couchbase as couchbasemetrics metrics = couchbasemetrics.get_metrics() print json.dumps(metrics, ensure_ascii=False)