问题
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