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参数 Type类型 Description描述
发现ID discoveryids string字符串型/array数组型 Return only graph prototypes that belong to the given discovery rules.只返回属于指定自动发现规则的图形原型
图形ID graphids string字符串型/array数组型 Return only graph prototypes with the given IDs.只返回含有给定ID的图形原型
组ID groupids string字符串型/array数组型 Return only graph prototypes that belong to hosts in the given host groups.只返回属于指定主机组的主机的图形原型
主机ID hostids string字符串型/array数组型 Return only graph prototypes that belong to the given hosts.只返回属于指定主机的图形原型
继承的 inherited boolean布尔型 If set to true return only graph prototypes inherited from a template.如果设置此参数为true,只返回从一个模板继承的图形原型。
监控项ID itemids string字符串型/array数组型 Return only graph prototypes that contain the given item prototypes.只返回包含给定监控项参数的图形原型
模板化的 templated boolean布尔型 If set to true return only graph prototypes that belong to templates. 如果此参数设置为true,只返回属于模板的图形原型。
模板ID templateids string字符串型/array数组型 Return only 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关联数组 Return 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 the result by the given properties.按指定的参数将结果排序 Possible values are:可用值: 图形ID graphid, 名称 name and 图形类型 graphtype.
countOutput flagThese 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请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "graphprototype.get",
  4. "params": {
  5. "output": "extend",
  6. "discoveryids": "27426"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "graphid": "1017",
  6. "parent_itemid": "27426",
  7. "name": "Disk space usage {#FSNAME}",
  8. "width": "600",
  9. "height": "340",
  10. "yaxismin": "0.0000",
  11. "yaxismax": "0.0000",
  12. "templateid": "442",
  13. "show_work_period": "0",
  14. "show_triggers": "0",
  15. "graphtype": "2",
  16. "show_legend": "1",
  17. "show_3d": "1",
  18. "percent_left": "0.0000",
  19. "percent_right": "0.0000",
  20. "ymin_type": "0",
  21. "ymax_type": "0",
  22. "ymin_itemid": "0",
  23. "ymax_itemid": "0"
  24. }
  25. ],
  26. "id": 1
  27. }

See also参见

Source来源

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