graphprototype.get

Description

描述

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

The method allows to retrieve graph prototypes according to the given parameters. 此方法用于根据给定的参数来获取图形原型

Parameters

参数

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

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

ParameterTypeDescription
discoveryidsstring/arrayReturn only graph prototypes that belong to the given discovery rules.
graphidsstring/arrayReturn only graph prototypes with the given IDs.
groupidsstring/arrayReturn only graph prototypes that belong to hosts in the given host groups.
hostidsstring/arrayReturn only graph prototypes that belong to the given hosts.
inheritedbooleanIf set to true return only graph prototypes inherited from a template.
itemidsstring/arrayReturn only graph prototypes that contain the given item prototypes.
templatedbooleanIf set to true return only graph prototypes that belong to templates.
templateidsstring/arrayReturn only graph prototypes that belong to the given templates.
selectDiscoveryRulequeryReturn the LLD rule that the graph prototype belongs to in the discoveryRule property.
selectGraphItemsqueryReturn the graph items used in the graph prototype in the gitems property.
selectGroupsqueryReturn the host groups that the graph prototype belongs to in the groups property.
selectHostsqueryReturn the hosts that the graph prototype belongs to in the hosts property.
selectItemsqueryReturn the items and item prototypes used in the graph prototype in the items property.
selectTemplatesqueryReturn the templates that the graph prototype belongs to in the templates property.
filterobjectReturn 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 prototype belongs to;
hostid - ID of the host that the graph prototype belongs to.
sortfieldstring/arraySort the result by the given properties.

Possible values are: graphid, name and graphtype.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
editableboolean
excludeSearchboolean
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean
参数 类描述
discoveryidsstring/array仅返回属于给定自动发现规则的图形原型.
graphidsstring/array仅返回含有给定ID的图形原型.
groupidsstring/array仅返回属于给定主机组的主机的图形原型.
hostidsstring/array仅返回属于给定主机的图形原型.
inheritedboolean如果设置此参数为 true ,则仅返回从模板继承的图形原型.
itemidsstring/array仅返回包含给定监控项原型的图形原型.
templatedboolean如果设置此参数为 true ,则仅返回属于模板的图形原型.
templateidsstring/array仅返回属于给定模板的图形原型.
selectDiscoveryRulequerydiscoveryRule 属性下,返回图形原型所属的低级别发现规则.
selectGraphItemsquerygitems 属性下,返回在图形原型中使用的图表监控项.
selectGroupsquerygroups 属性下,返回图形原型所属的主机组.
selectHostsqueryhosts 属性下,返回图形原型所属的主机.
selectItemsqueryitems 属性下,返回在图形原型中使用的监控项以及监控项原型.
selectTemplatesquerytemplates 属性下,返回图形原型所属的模板.
filterobject仅返回精确匹配给定过滤器的结果.

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

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

可能值: graphid, name 以及 graphtype.
countOutputboolean以下参数为 get 方法通常参数,在参考注释有详细说明…
editableboolean
excludeSearchboolean
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

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.