获取

描述

integer/array graphitem.get(object parameters)

该方法允许根据给定的参数来检索图形监控项。

这种方法对任何类型的用户都适用。调用该方法的权限可以在用户角色设置中撤销。前往用户角色以获取更多信息。

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

参数 类型 描述
graphids ID/数组 仅返回属于给定图表的图表项。
itemids ID/数组 仅返回具有给定监控项ID的图表项。
type 整数 仅返回具有给定类型的图表项。

参阅图表项对象页面,获取支持的图表项类型列表。
selectGraphs 查询 返回一个graphs属性,其中包含一个数组,表示该项所属的图表。

参见图表对象
sortfield 字符串/数组 根据给定属性对结果进行排序。

可能的值: gitemid
countOutput 布尔值 这些参数在参考说明中描述。
editable 布尔值
limit 整数
output 查询
preservekeys 布尔值
sortorder 字符串/数组

返回值

返回值是 (integer/array) 其中之一:

  • 一个对象的数组;
  • 如果使用了countOutput参数,则为检索到的对象的数量。

示例

从图形中检索图形监控项

检索图形中使用的所有图形监控项,以及相关的监控项和主机的额外信息。

请求:

{
           "jsonrpc": "2.0",
           "method": "graphitem.get",
           "params": {
               "output": "extend",
               "graphids": "387"
           },
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "gitemid": "1242",
                   "graphid": "387",
                   "itemid": "22665",
                   "drawtype": "1",
                   "sortorder": "1",
                   "color": "FF5555",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0"
               },
               {
                   "gitemid": "1243",
                   "graphid": "387",
                   "itemid": "22668",
                   "drawtype": "1",
                   "sortorder": "2",
                   "color": "55FF55",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0"
               },
               {
                   "gitemid": "1244",
                   "graphid": "387",
                   "itemid": "22671",
                   "drawtype": "1",
                   "sortorder": "3",
                   "color": "009999",
                   "yaxisside": "0",
                   "calc_fnc": "2",
                   "type": "0"
               }
           ],
           "id": 1
       }

另见

源码

CGraphItem::get() in ui/include/classes/api/services/CGraphItem.php.