trend.get

Description说明

integer/array trend.get(object parameters)

The method allows to retrieve trend data according to the given parameters该方法用于根据规定的参数获取趋势数据.

Parameters参数

(object) Parameters defining the desired output定义所需输出的参数.

The method supports the following parameters该方法提供以下参数.

Parameter参数 T pe类型 Des ription说明
itemids string/array Return only trends with the given item IDs只返回包含特定监控项的趋势.
time_from timestamp Return only values that have been collected after or at the given time只返回包含特定时间后或之后获取的值.
time_till timestamp Return only values that have been collected before or at the given time只返回包含特定时间前或之前获取的值.
countOutput flag Count the number of retrieved objects计算检索对象的数量.
limit integer Limit the amount of retrieved objects限制检索对象的数量.
output query Set fields to output将字段设置为输出.

Return values返回值

(integer/array) Returns either返回两者其中任一:

  • an array of objects一组对象;
  • the count of retrieved objects, if the countOutput parameter has been used.如果已经使用了“countOutput”参数,则检索对象的计数.

Examples范例

Retrieving item trend data从监控项中检索趋势数据

Request请求:

{
           "jsonrpc": "2.0",
           "method": "trend.get",
           "params": {
               "output": [
                   "itemid",
                   "clock",
                   "num",
                   "value_min",
                   "value_avg",
                   "value_max",
               ],
               "itemids": [
                   "23715"
               ],
               "limit": "1"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "itemid": "23715",
                   "clock": "1446199200",
                   "num": "60",
                   "value_min": "0.1650",
                   "value_avg": "0.2168",
                   "value_max": "0.3500",
               }
           ],
           "id": 1
       }

Source来源

CTrend::get() in frontends/php/include/classes/api/services/CTrend.php.