4.graphprototype.get

描述

整数/数组 graphprototype.get(object parameters)

此方法用于根据给定的参数来获取图表原型。

参数

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

此方法支持以下参数:

参数 类 描述
discoveryids string/array 仅返回属于给定自动发现规则的图表原型。
graphids string/array 仅返回含有给定ID的图表原型。
groupids string/array 仅返回属于给定主机组的主机的图表原型。
hostids string/array 仅返回属于给定主机的图表原型。
inherited boolean 如果设置此参数为 true ,则仅返回从模板继承的图表原型。
itemids string/array 仅返回包含给定监控项原型的图表原型。
templated boolean 如果设置此参数为 true ,则仅返回属于模板的图表原型。
templateids string/array 仅返回属于给定模板的图表原型。
selectDiscoveryRule query 在 discoveryRule 属性下,返回图表原型所属的低级别发现规则。
selectGraphItems query 在 gitems 属性下,返回在图表原型中使用的图表监控项。
selectGroups query 在 groups 属性下,返回图表原型所属的主机组。
selectHosts query 在 hosts 属性下,返回图表原型所属的主机。
selectItems query 在 items 属性下,返回在图表原型中使用的监控项以及监控项原型。
selectTemplates query 在 templates 属性下,返回图表原型所属的模板。
filter object 仅返回精确匹配给定过滤器的结果。

接受一个数组,其中键是属性名称,值是单个值或要匹配的值的数组。

支持的额外的过滤器:
host - 图表原型所属主机的技术名称。
hostid - 图表原型所属主机的ID。
sortfield string/array 根据给定属性对结果进行排序。

可能值: graphid, name 以及 graphtype。
countOutput boolean 以下参数为 get 方法通常参数,在参考注释有详细说明...
editable boolean
excludeSearch boolean
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(整数/数组) 返回:

  • 一个数组对象;
  • 如果使用了 countOutput 参数,返回获取的对象的数量。

示例

从低级别发现规则获取图表原型

从低级别发现规则获取所有图表原型。

请求:

{
    "jsonrpc": "2.0",
    "method": "graphprototype.get",
    "params": {
        "output": "extend",
        "discoveryids": "27426"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

响应:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "graphid": "1017",
            "parent_itemid": "27426",
            "name": "Disk space usage {#FSNAME}",
            "width": "600",
            "height": "340",
            "yaxismin": "0.0000",
            "yaxismax": "0.0000",
            "templateid": "442",
            "show_work_period": "0",
            "show_triggers": "0",
            "graphtype": "2",
            "show_legend": "1",
            "show_3d": "1",
            "percent_left": "0.0000",
            "percent_right": "0.0000",
            "ymin_type": "0",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0"
        }
    ],
    "id": 1
}

参考

来源

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