2022 Zabbix中国峰会
2022 Zabbix中国峰会

graphprototype.get

Description描述

integer/array graphprototype.get(object parameters)

The method allows to retrieve graph prototypes according to the given parameters.此方法允许按照给定的参数检索图形原型。

Parameters参数

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

The method supports the following parameters.此方法支持以下参数。

Parameter参数 T pe类型 Des ription描述
发现ID discoveryids s ring字符串型/array数组型 Return o ly graph prototypes that belong to the given discovery rules.只返回属于指定自动发现规则的图形原型
图形ID graphids s ring字符串型/array数组型 Return o ly graph prototypes with the given IDs.只返回含有给定ID的图形原型
组ID groupids tring字符串型/array数组型 Return nly graph prototypes that belong to hosts in the given host groups.只返回属于指定主机组的主机的图形原型
主机ID hostids s ring字符串型/array数组型 Return o ly graph prototypes that belong to the given hosts.只返回属于指定主机的图形原型
继承的 inherited bo lean布尔型 If se to true return only graph prototypes inherited from a template.如果设置此参数为true,只返回从一个模板继承的图形原型。
监控项ID itemids st ing字符串型/array数组型 Return on y graph prototypes that contain the given item prototypes.只返回包含给定监控项参数的图形原型
模板化的 templated boo ean布尔型 If set to true return only graph prototypes that belong to templates. 如果此参数设置为true,只返回属于模板的图形原型。
模板ID templateids s ring字符串型/array数组型 Return o ly graph prototypes that belong to the given templates. 只返回属于指定模板的图形原型。
selectDiscoveryRule query Return the LLD rule that the graph prototype belongs to in the discoveryRule property.返回图形原型中discoveryRule参数内的低级发现规则
selectGraphItems query Return the graph items used in the graph prototype in the gitems property. 返回图形原型中gitems参数内被使用的图形项目
selectGroups query Return the host groups that the graph prototype belongs to in the groups property.返回图形原型中groups参数内的主机组
selectHosts query Return the hosts that the graph prototype belongs to in the hosts property. 返回图形原型中hosts参数内的主机
selectItems query Return the items and item prototypes used in the graph prototype in the items property.返回图形原型中itemss参数内的监控项
selectTemplates query Return the templates that the graph prototype belongs to in the templates property. 返回图形原型templatess参数内的模板
filter object关联数组 Ret rn only those results that exactly match the given filter.只返回与给定过滤器完全匹配的结果。
\\Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against. 接受一个数组,其中的键是属性名,值可以是一个值或者是一个匹配的值数组。
\\Supports additional filters: 支持额外过滤器:
host - technical name of the host that the graph belongs to;图形所属主机的名称
hostid - ID of the host that the graph belongs to.图形所属主机的ID
sortfield string字符串型/array数组型 Sort t e result by the given properties.按指定的参数将结果排序

Possible values are:可用值: 图形ID graphid, 名称 name and 图形类型 graphtype.
countOutput flag These parameters being common for all get methods are described in detail in the reference commentary.这些参数对于所有get方法都是通用的,在附录1:参考中,查看详细描述。
editable boolean
excludeSearch flag
limit integer
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

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 graph prototypes from a LLD rule从一个低级发现规则检索图形原型

Retrieve all graph prototypes from an LLD rule.从一个低级发现规则检索图形原型

Request请求:

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

Response响应:

{
           "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
       }

See also参见

Source来源

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