OpenTSDB - Get all metrics via http

核能气质少年 提交于 2019-12-02 05:01:50

问题


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

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;

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


回答1:


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.

Example Request Query String

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

JSON Content

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


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



来源:https://stackoverflow.com/questions/18396365/opentsdb-get-all-metrics-via-http

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!