我正在使用datastax opscenter api通过python脚本检索指标并尝试将结果与opscenter上的图形匹配
我正在尝试获取'TBL : LiveDisk Used'的数据,如下图所示:enter image description here
python脚本中的函数如下:
def diskUsage(url11, cluster_id, start_time, end_time, node_ip1):
p = {'metrics': 'cf-live-disk-used',
'columnfamilies': 'all',
'nodes': node_ip1,
'step': '120',
'start': start_time,
'end': end_time }
url="http://"+url11+"/"+cluster_id+"/metrics/"+node_ip1+"/cf-live-disk-used"
MetricSingleNode = session.get(url, params=p)
DataC = json.loads(MetricSingleNode.content)
print "DataC is ", DataC
输出:
DataC is {u'{node_ip}': {u'MAX': [[1469930400, None]],
u'AVERAGE': [[1469930400, None]],
u'MIN': [[1469930400, None]]
}
}
为什么在opscenter提供数据时输出为none?
帮助将受到高度赞赏
1 回答
在您的屏幕截图中,opscenter正在阅读1分钟的时间段指标 . 您的查询正在拉动2小时的时间段(可能没有数据在您的开始/结束范围内) . 尝试使用
step:1
运行 .