说明

    The method allows to retrieve item prototypes according to the given parameters. 此方法可以根据提供的参数获取item prototypes。

    Parameters

    (object) Parameters defining the desired output. (object) 参数定义期望输出

    The method supports the following parameters. 此方法提供以下参数。

    返回值

    (integer/array) Returns either:

    • an array of objects;对象数组;

    • the count of retrieved objects, if the countOutput parameter has been used.已获取到的对象的数量,如果countOutput参数被使用。

    Examples

    Retrieving item prototypes from an LLD rule

    获取 item prototypes

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "23077",
    6. "type": "0",
    7. "snmp_community": "",
    8. "snmp_oid": "",
    9. "hostid": "10079",
    10. "name": "Incoming network traffic on $1",
    11. "key_": "net.if.in[en0]",
    12. "delay": "1m",
    13. "history": "1w",
    14. "trends": "365d",
    15. "status": "0",
    16. "value_type": "3",
    17. "trapper_hosts": "",
    18. "units": "bps",
    19. "snmpv3_securityname": "",
    20. "snmpv3_securitylevel": "0",
    21. "snmpv3_authpassphrase": "",
    22. "snmpv3_privpassphrase": "",
    23. "formula": "",
    24. "error": "",
    25. "lastlogsize": "0",
    26. "logtimefmt": "",
    27. "templateid": "0",
    28. "valuemapid": "0",
    29. "params": "",
    30. "ipmi_sensor": "",
    31. "authtype": "0",
    32. "username": "",
    33. "password": "",
    34. "publickey": "",
    35. "privatekey": "",
    36. "mtime": "0",
    37. "flags": "0",
    38. "interfaceid": "0",
    39. "port": "",
    40. "description": "",
    41. "inventory_link": "0",
    42. "lifetime": "30d",
    43. "snmpv3_authprotocol": "0",
    44. "snmpv3_privprotocol": "0",
    45. "state": "0",
    46. "snmpv3_contextname": "",
    47. "evaltype": "0",
    48. "jmx_endpoint": "",
    49. "master_itemid": "0",
    50. "timeout": "3s",
    51. "url": "",
    52. "query_fields": [],
    53. "posts": "",
    54. "status_codes": "200",
    55. "follow_redirects": "1",
    56. "post_type": "0",
    57. "http_proxy": "",
    58. "headers": [],
    59. "retrieve_mode": "0",
    60. "request_method": "1",
    61. "output_format": "0",
    62. "ssl_cert_file": "",
    63. "ssl_key_file": "",
    64. "ssl_key_password": "",
    65. "verify_peer": "0",
    66. "verify_host": "0",
    67. "allow_traps": "0",
    68. "lastns": "0",
    69. "lastvalue": "0",
    70. "prevvalue": "0"
    71. },
    72. {
    73. "itemid": "10010",
    74. "type": "0",
    75. "snmp_community": "",
    76. "snmp_oid": "",
    77. "hostid": "10001",
    78. "name": "Processor load (1 min average per core)",
    79. "key_": "system.cpu.load[percpu,avg1]",
    80. "delay": "1m",
    81. "history": "1w",
    82. "trends": "365d",
    83. "status": "0",
    84. "value_type": "0",
    85. "units": "",
    86. "snmpv3_securityname": "",
    87. "snmpv3_securitylevel": "0",
    88. "snmpv3_authpassphrase": "",
    89. "snmpv3_privpassphrase": "",
    90. "formula": "",
    91. "error": "",
    92. "lastlogsize": "0",
    93. "logtimefmt": "",
    94. "templateid": "0",
    95. "valuemapid": "0",
    96. "params": "",
    97. "ipmi_sensor": "",
    98. "authtype": "0",
    99. "username": "",
    100. "password": "",
    101. "publickey": "",
    102. "privatekey": "",
    103. "mtime": "0",
    104. "flags": "0",
    105. "interfaceid": "0",
    106. "port": "",
    107. "description": "The processor load is calculated as system CPU load divided by number of CPU cores.",
    108. "inventory_link": "0",
    109. "lifetime": "0",
    110. "snmpv3_authprotocol": "0",
    111. "snmpv3_privprotocol": "0",
    112. "state": "0",
    113. "snmpv3_contextname": "",
    114. "evaltype": "0",
    115. "jmx_endpoint": "",
    116. "master_itemid": "0",
    117. "timeout": "3s",
    118. "url": "",
    119. "query_fields": [],
    120. "posts": "",
    121. "status_codes": "200",
    122. "follow_redirects": "1",
    123. "post_type": "0",
    124. "http_proxy": "",
    125. "headers": [],
    126. "retrieve_mode": "0",
    127. "request_method": "1",
    128. "output_format": "0",
    129. "ssl_cert_file": "",
    130. "ssl_key_file": "",
    131. "ssl_key_password": "",
    132. "verify_peer": "0",
    133. "verify_host": "0",
    134. "allow_traps": "0",
    135. "lastclock": "0",
    136. "lastns": "0",
    137. "lastvalue": "0",
    138. "prevvalue": "0"
    139. }
    140. ],
    141. "id": 1
    142. }

    Finding dependent item

    查找依赖的item

    Find one Dependent item for item with ID “25545”. 为ID为“25545”的item查找一个赖的 item。

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "25547",
    6. "type": "18",
    7. "snmp_community": "",
    8. "snmp_oid": "",
    9. "hostid": "10116",
    10. "name": "Seconds",
    11. "key_": "apache.status.uptime.seconds",
    12. "delay": "0",
    13. "history": "90d",
    14. "trends": "365d",
    15. "status": "0",
    16. "value_type": "3",
    17. "trapper_hosts": "",
    18. "units": "",
    19. "snmpv3_securityname": "",
    20. "snmpv3_securitylevel": "0",
    21. "snmpv3_authpassphrase": "",
    22. "snmpv3_privpassphrase": "",
    23. "formula": "",
    24. "error": "",
    25. "lastlogsize": "0",
    26. "logtimefmt": "",
    27. "templateid": "0",
    28. "valuemapid": "0",
    29. "params": "",
    30. "ipmi_sensor": "",
    31. "authtype": "0",
    32. "username": "",
    33. "password": "",
    34. "publickey": "",
    35. "mtime": "0",
    36. "flags": "0",
    37. "interfaceid": "0",
    38. "port": "",
    39. "description": "",
    40. "inventory_link": "0",
    41. "lifetime": "30d",
    42. "snmpv3_authprotocol": "0",
    43. "snmpv3_privprotocol": "0",
    44. "state": "0",
    45. "snmpv3_contextname": "",
    46. "master_itemid": "25545",
    47. "jmx_endpoint": "",
    48. "master_itemid": "0",
    49. "timeout": "3s",
    50. "url": "",
    51. "query_fields": [],
    52. "posts": "",
    53. "status_codes": "200",
    54. "follow_redirects": "1",
    55. "post_type": "0",
    56. "http_proxy": "",
    57. "headers": [],
    58. "retrieve_mode": "0",
    59. "request_method": "1",
    60. "output_format": "0",
    61. "ssl_cert_file": "",
    62. "ssl_key_file": "",
    63. "ssl_key_password": "",
    64. "verify_peer": "0",
    65. "verify_host": "0",
    66. "allow_traps": "0",
    67. "lastclock": "0",
    68. "lastns": "0",
    69. "lastvalue": "0",
    70. "prevvalue": "0"
    71. }
    72. ],
    73. "id": 1
    74. }

    Find HTTP agent item prototype

    查找 HTTP agent item prototype

    Find HTTP agent item prototype with request method HEAD for specific host id. 为请求方法头定义的host id查找HTTP agent item prototype。

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "28257",
    6. "type": "19",
    7. "snmp_community": "",
    8. "snmp_oid": "",
    9. "hostid": "10254",
    10. "name": "discovered",
    11. "key_": "item[{#INAME}]",
    12. "delay": "{#IUPDATE}",
    13. "history": "90d",
    14. "trends": "30d",
    15. "status": "0",
    16. "value_type": "3",
    17. "trapper_hosts": "",
    18. "units": "",
    19. "snmpv3_securityname": "",
    20. "snmpv3_securitylevel": "0",
    21. "snmpv3_authpassphrase": "",
    22. "snmpv3_privpassphrase": "",
    23. "formula": "",
    24. "error": "",
    25. "lastlogsize": "0",
    26. "logtimefmt": "",
    27. "templateid": "28255",
    28. "valuemapid": "0",
    29. "params": "",
    30. "ipmi_sensor": "",
    31. "authtype": "0",
    32. "username": "",
    33. "password": "",
    34. "publickey": "",
    35. "privatekey": "",
    36. "mtime": "0",
    37. "flags": "2",
    38. "interfaceid": "2",
    39. "port": "",
    40. "description": "",
    41. "inventory_link": "0",
    42. "lifetime": "30d",
    43. "snmpv3_authprotocol": "0",
    44. "snmpv3_privprotocol": "0",
    45. "state": "0",
    46. "snmpv3_contextname": "",
    47. "evaltype": "0",
    48. "jmx_endpoint": "",
    49. "master_itemid": "0",
    50. "timeout": "3s",
    51. "url": "{#IURL}",
    52. "query_fields": [],
    53. "posts": "",
    54. "status_codes": "",
    55. "follow_redirects": "0",
    56. "post_type": "0",
    57. "http_proxy": "",
    58. "headers": [],
    59. "retrieve_mode": "0",
    60. "request_method": "3",
    61. "output_format": "0",
    62. "ssl_cert_file": "",
    63. "ssl_key_file": "",
    64. "ssl_key_password": "",
    65. "verify_peer": "0",
    66. "verify_host": "0",
    67. "allow_traps": "0"
    68. }
    69. ],
    70. }

    See also

    参考其他

    Source

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