我是初学者,所以请多多关照。我想从服务器上安装的一些虚拟机下载CPU利用率。服务器安装了Graphite。我安装了Python graphite api,并且我有服务器连接的详细信息。如何调用REST api开始拉取数据?
发布于 2015-05-11 02:40:31
使用requests包:
>>> r = requests.get('https://your_graphite_host.com/render?target=app.numUsers&format=json', auth=('user', 'pass'))
>>> r.json() # this will give your the JSON file with the data请记住,您必须将app.numUsers替换为适当的指标名称。您还可以请求其他格式和时间范围,请参阅graphite-api docs。
https://stackoverflow.com/questions/29807752
复制相似问题