? ? ? ? ?
/api/stats /api/suggest /api/tree /api/uid /api/version
3.1 /api/suggest
这个API提供一个自动填充的功能。它可以查询到
Requests NamData RequireDescription e Type d The type of data to auto complete on. Must be one of Requiretype String the d following: metrics, tagk or tagv A string to match on for the q String Optional given type The maximum number of Integemax Optional suggested results to return. r Must be greater than 0
请求示例:http://10.1.170.204:4242/suggest?type=metrics&q=p
返回的是JSON格式的数据
Default QS RW Example type metrics 25 q max web 10
3.2 /api/query
对于使用者来说,可能最有用处的就是/api/query,所以着重学习/api/query /api/query的请求方式有3种:get post delete。其中2.2版本或的数据匹配查询可以发送delete请求,在tsd.http.query.allow_delete配置元素允许删除deletions的时候。
(1) 请求元素
包括以下 Name Data Type Required Description The start time for the query. This can be a relative or absolute timestamp. SeeQuerying or Reading Data for details. An end time for the query. If not supplied, the TSD will assume the local system current time on the time server. This may be a relative or absolute timestamp. Default QS RW Example start String, Integer Required start 1h-ago end String, Integer Optional end 1s-ago Name Data Type Required Description SeeQuerying or Reading Data for details. One or more sub queries used to select the time series to return. These may be metric m or TSUID tsuids queries Default QS RW Example queries Array Required m or tsuids See below noAnnotations Boolean Optional Whether or not to return annotations with a query. The default is to return annotations for the requested false timespan but this flag can disable the return. This affects both local and global notes and overrides globalAnnotations no_annotations false globalAnnotations Boolean Optional Whether or not the query should retrieve global annotations for the requested timespan false global_annotations true msResolution Boolean Optional Whether or not to output data point timestamps in milliseconds or seconds. If false this flag is not provided and there are multiple data points ms true Name Data Type Required Description within a second, those data points will be down sampled using the query's aggregation function. Whether or not to output the TSUIDs associated with timeseries in the results. If multiple time series were aggregated into one set, multiple TSUIDs will be returned in a sorted manner Whether or not to show a Default QS RW Example showTSUIDs Boolean Optional false show_tsuids true showSummary Boolean Optional summary of timings surrounding the query in the false results. This creates another object in the map that is unlike the data point objects. Whether or not to return the original sub query with the query results. If the request contains many sub queries then this is a good way to determine show_sum mary true showQuerBoolean y Optional false show_query true Name Data Type Required Description which results belong to which sub query. Note that in the case of a * or wildcard query, this can produce a lot of duplicate output. Can be passed to the JSON with a POST to delete any data points that match the given query. Default QS RW Example delete Boolean Optional false W
(2) 子查询
OpenTSDB的查询语句需要至少一条子查询,并且时间序列应该在请求的结果集里面,有两种查询方式:
Metric Query - The full name of a metric is supplied along with an optional
list of tags. This is optimized for aggregating multiple time series into one result.
? TSUID Query - A list of one or more TSUIDs that share a common metric. This is optimized for fetching individual time series where aggregation is not required.
?
在一条查询语句中可以包含任意多个这两种查询方式。当提交一个查询请求时,如果一系列的TSUID都提供的话,另外提供的metric和tags将会被忽略。
每个子查询可以检索一条或一组时间序列对应的指标项,也可以对查询的结果集进行聚合函数处理和分组运算。子查询字段包括: Name aggregator metric Data Type String String Required Description Default Example sum sys.cpu.0 The name of an aggregation Required function to use. See/api/aggregators The name of a metric stored Required in the system
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库OpenTSDB的简单入门(2)在线全文阅读。
相关推荐: