itemprototype.get

Description 说明

integer/array itemprototype.get(object parameters)

The method allows to retrieve item prototypes according to the given parameters.该方法允许根据给定的参数检索item prototypes。

Parameters 参数

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

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

属性 类型 说明
discoveryids string/array Return only item prototypes that belong to the given LLD rules.
graphids string/array Return only item prototypes that are used in the given graph prototypes.
hostids string/array Return only item prototypes that belong to the given hosts.
inherited boolean If set to true return only item prototypes inherited from a template.
itemids string/array Return only item prototypes with the given IDs.
monitored boolean If set to true return only enabled item prototypes that belong to monitored hosts.
templated boolean If set to true return only item prototypes that belong to templates.
templateids string/array Return only item prototypes that belong to the given templates.
triggerids string/array Return only item prototypes that are used in the given trigger prototypes.
selectApplications query Return applications that the item prototype belongs to in the applications property.
selectApplicationPrototypes query Return application prototypes linked to item prototype in applicationPrototypes property.
selectDiscoveryRule query Return the low-level discovery rule that the graph prototype belongs to in the discoveryRule property.
selectGraphs query Return graph prototypes that the item prototype is used in in the graphs property. Supports count.
selectHosts query Returns the host that the item prototype belongs to as an array in the hosts property.
selectTriggers query Return trigger prototypes that the item prototype is used in in the triggers property. Supports count.
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 item prototype belongs to.
limitSelects integer Limits the number of records returned by subselects. Applies to the following subselects: selectGraphs - results will be sorted by name; selectTriggers - results will be sorted by description.
sortfield string/array Sort the result by the given properties. Possible values are: itemid, name, key_, delay, type and status.
countOutput flagThese parameters being common for all get methods are described in detail in the reference commentary.
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.

Examples示例

Retrieving item prototypes from an LLD rule

Retrieve all item prototypes from an LLD rule.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "itemprototype.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. "itemid": "27427",
  6. "type": "0",
  7. "snmp_community": "",
  8. "snmp_oid": "",
  9. "hostid": "10202",
  10. "name": "Incoming network traffic on $1 23",
  11. "key_": "2net.if.in[{#IFNAME}]",
  12. "delay": "1m",
  13. "history": "7d",
  14. "trends": "365d",
  15. "status": "0",
  16. "value_type": "3",
  17. "trapper_hosts": "",
  18. "units": "bps",
  19. "multiplier": "1",
  20. "delta": "1",
  21. "snmpv3_securityname": "",
  22. "snmpv3_securitylevel": "0",
  23. "snmpv3_authpassphrase": "",
  24. "snmpv3_privpassphrase": "",
  25. "formula": "8",
  26. "logtimefmt": "",
  27. "templateid": "23881",
  28. "valuemapid": "0",
  29. "params": "",
  30. "ipmi_sensor": "",
  31. "data_type": "0",
  32. "authtype": "0",
  33. "username": "",
  34. "password": "",
  35. "publickey": "",
  36. "privatekey": "",
  37. "mtime": "0",
  38. "filter": "",
  39. "interfaceid": "119",
  40. "port": "",
  41. "description": "",
  42. "snmpv3_authprotocol": "0",
  43. "snmpv3_privprotocol": "0"
  44. },
  45. {
  46. "itemid": "27428",
  47. "type": "0",
  48. "snmp_community": "",
  49. "snmp_oid": "",
  50. "hostid": "10202",
  51. "name": "Incoming network traffic on $1",
  52. "key_": "net.if.in[{#IFNAME}]",
  53. "delay": "1m",
  54. "history": "7d",
  55. "trends": "365d",
  56. "status": "0",
  57. "value_type": "3",
  58. "trapper_hosts": "",
  59. "units": "bps",
  60. "multiplier": "1",
  61. "delta": "1",
  62. "snmpv3_securityname": "",
  63. "snmpv3_securitylevel": "0",
  64. "snmpv3_authpassphrase": "",
  65. "snmpv3_privpassphrase": "",
  66. "formula": "8",
  67. "logtimefmt": "",
  68. "templateid": "22446",
  69. "valuemapid": "0",
  70. "params": "",
  71. "ipmi_sensor": "",
  72. "data_type": "0",
  73. "authtype": "0",
  74. "username": "",
  75. "password": "",
  76. "publickey": "",
  77. "privatekey": "",
  78. "mtime": "0",
  79. "filter": "",
  80. "interfaceid": "119",
  81. "port": "",
  82. "description": "",
  83. "snmpv3_authprotocol": "0",
  84. "snmpv3_privprotocol": "0"
  85. }
  86. ],
  87. "id": 1
  88. }

See also 参见

Source 来源

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