本文介绍了OpenTSDB-通过http获取所有指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从OpenTSDB获取一些数据,但是无法计算出如何通过http获取指标列表?

I am getting some data from OpenTSDB, but cannot work out how to get a list of metrics via http?

作为参考,这是我用来获取数据返回的c#代码.是否有一个网址可以返回所有指标?

For reference, here's the c# code I'm using to get databack. Is there a url that would return all metrics?

var request = WebRequest.Create("http://localhost:4242/api/version?jsonp=callback");
request.ContentType = "application/json; charset=utf-8";
string text;
var response = (HttpWebResponse)request.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{
    text = sr.ReadToEnd();
}

uxResponse.Text = text;

默认的OpenTSDB网站按照以下屏幕截图提供此功能,我想从我的asp站点模仿.

The default OpenTSDB website provides this functionality as per following screenshot, I want to mimic this from a my asp site.

推荐答案

好,api/suggest根据提供的匹配参数返回列表.尽管它不会返回所有指标,但它为我提供了使其工作的方法.

OK, api/suggest returns the list based on matching supplied parameter. This will get me out of trouble on this question, although it doesn't return all metrics it gives me a method to make it work.

示例查询字符串

http://localhost:4242/api/suggest?type=metrics&q=sys&max=10 

JSON内容

{
  "type":"metrics",
  "q":"sys",
  "max":10
}


希望对其他人(基本上是RTFM)有所帮助! ( http://opentsdb.net/docs/build/html/api_http/suggest. html )


I hope this helps anyone else, basically RTFM! (http://opentsdb.net/docs/build/html/api_http/suggest.html)

这篇关于OpenTSDB-通过http获取所有指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 01:23