简体   繁体   English

OpenTSDB-通过http获取所有指标

[英]OpenTSDB - Get all metrics via http

I am getting some data from OpenTSDB, but cannot work out how to get a list of metrics via http? 我从OpenTSDB获取一些数据,但是无法计算出如何通过http获取指标列表?

For reference, here's the c# code I'm using to get databack. 作为参考,这是我用来获取数据返回的C#代码。 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;

The default OpenTSDB website provides this functionality as per following screenshot, I want to mimic this from a my asp site. 默认的OpenTSDB网站按照以下屏幕截图提供此功能,我想从我的asp站点模仿它。

在此处输入图片说明

OK, api/suggest returns the list based on matching supplied parameter. OK,api / suggest根据提供的匹配参数返回列表。 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. 尽管它不会返回所有指标,但它为我提供了使其工作的方法,尽管这并没有返回所有指标,但这使我摆脱了这个问题。

Example Request Query String 请求查询字符串示例

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

JSON Content JSON内容

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


I hope this helps anyone else, basically RTFM! 希望对其他人(基本上是RTFM)有所帮助! ( http://opentsdb.net/docs/build/html/api_http/suggest.html ) http://opentsdb.net/docs/build/html/api_http/suggest.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM