item.get

    The method allows to retrieve items according to the given parameters.

    This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

    Parameters

    (object) Parameters defining the desired output.

    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.

    Examples

    Finding items by key

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "23298",
    6. "type": "0",
    7. "snmp_oid": "",
    8. "hostid": "10084",
    9. "name": "Context switches per second",
    10. "key_": "system.cpu.switches",
    11. "delay": "1m",
    12. "history": "7d",
    13. "trends": "365d",
    14. "lastvalue": "2552",
    15. "lastclock": "1351090998",
    16. "prevvalue": "2641",
    17. "state": "0",
    18. "status": "0",
    19. "value_type": "3",
    20. "trapper_hosts": "",
    21. "units": "sps",
    22. "error": "",
    23. "logtimefmt": "",
    24. "templateid": "22680",
    25. "valuemapid": "0",
    26. "params": "",
    27. "ipmi_sensor": "",
    28. "authtype": "0",
    29. "username": "",
    30. "password": "",
    31. "publickey": "",
    32. "privatekey": "",
    33. "lastns": "564054253",
    34. "flags": "0",
    35. "interfaceid": "1",
    36. "description": "",
    37. "inventory_link": "0",
    38. "lifetime": "0s",
    39. "evaltype": "0",
    40. "jmx_endpoint": "",
    41. "master_itemid": "0",
    42. "timeout": "3s",
    43. "url": "",
    44. "query_fields": [],
    45. "posts": "",
    46. "status_codes": "200",
    47. "follow_redirects": "1",
    48. "post_type": "0",
    49. "http_proxy": "",
    50. "headers": [],
    51. "retrieve_mode": "0",
    52. "request_method": "0",
    53. "output_format": "0",
    54. "ssl_cert_file": "",
    55. "ssl_key_file": "",
    56. "ssl_key_password": "",
    57. "verify_peer": "0",
    58. "verify_host": "0",
    59. "allow_traps": "0",
    60. "parameters": []
    61. },
    62. {
    63. "itemid": "23299",
    64. "type": "0",
    65. "snmp_oid": "",
    66. "hostid": "10084",
    67. "name": "CPU $2 time",
    68. "key_": "system.cpu.util[,idle]",
    69. "delay": "1m",
    70. "history": "7d",
    71. "trends": "365d",
    72. "lastvalue": "86.031879",
    73. "lastclock": "1351090999",
    74. "prevvalue": "85.306944",
    75. "state": "0",
    76. "status": "0",
    77. "value_type": "0",
    78. "trapper_hosts": "",
    79. "units": "%",
    80. "error": "",
    81. "logtimefmt": "",
    82. "templateid": "17354",
    83. "valuemapid": "0",
    84. "params": "",
    85. "ipmi_sensor": "",
    86. "authtype": "0",
    87. "username": "",
    88. "password": "",
    89. "publickey": "",
    90. "privatekey": "",
    91. "lastns": "564256864",
    92. "flags": "0",
    93. "interfaceid": "1",
    94. "description": "The time the CPU has spent doing nothing.",
    95. "inventory_link": "0",
    96. "lifetime": "0s",
    97. "evaltype": "0",
    98. "jmx_endpoint": "",
    99. "master_itemid": "0",
    100. "url": "",
    101. "query_fields": [],
    102. "posts": "",
    103. "status_codes": "200",
    104. "follow_redirects": "1",
    105. "post_type": "0",
    106. "http_proxy": "",
    107. "headers": [],
    108. "retrieve_mode": "0",
    109. "request_method": "0",
    110. "output_format": "0",
    111. "ssl_cert_file": "",
    112. "ssl_key_file": "",
    113. "ssl_key_password": "",
    114. "verify_peer": "0",
    115. "verify_host": "0",
    116. "allow_traps": "0",
    117. "parameters": []
    118. },
    119. {
    120. "itemid": "23300",
    121. "type": "0",
    122. "hostid": "10084",
    123. "name": "CPU $2 time",
    124. "key_": "system.cpu.util[,interrupt]",
    125. "history": "7d",
    126. "trends": "365d",
    127. "lastvalue": "0.008389",
    128. "lastclock": "1351091000",
    129. "prevvalue": "0.000000",
    130. "state": "0",
    131. "status": "0",
    132. "value_type": "0",
    133. "trapper_hosts": "",
    134. "units": "%",
    135. "error": "",
    136. "logtimefmt": "",
    137. "templateid": "22671",
    138. "valuemapid": "0",
    139. "params": "",
    140. "ipmi_sensor": "",
    141. "authtype": "0",
    142. "username": "",
    143. "password": "",
    144. "publickey": "",
    145. "privatekey": "",
    146. "lastns": "564661387",
    147. "flags": "0",
    148. "interfaceid": "1",
    149. "description": "The amount of time the CPU has been servicing hardware interrupts.",
    150. "inventory_link": "0",
    151. "lifetime": "0s",
    152. "evaltype": "0",
    153. "jmx_endpoint": "",
    154. "master_itemid": "0",
    155. "timeout": "3s",
    156. "url": "",
    157. "query_fields": [],
    158. "posts": "",
    159. "status_codes": "200",
    160. "follow_redirects": "1",
    161. "post_type": "0",
    162. "http_proxy": "",
    163. "headers": [],
    164. "retrieve_mode": "0",
    165. "request_method": "0",
    166. "output_format": "0",
    167. "ssl_cert_file": "",
    168. "ssl_key_file": "",
    169. "ssl_key_password": "",
    170. "verify_peer": "0",
    171. "verify_host": "0",
    172. "allow_traps": "0",
    173. "parameters": []
    174. }
    175. ],
    176. "id": 1
    177. }

    Finding dependent items by key

    Retrieve all dependent items from host with ID “10116” that have the word “apache” in the key.

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "25550",
    6. "type": "18",
    7. "snmp_oid": "",
    8. "hostid": "10116",
    9. "name": "Days",
    10. "key_": "apache.status.uptime.days",
    11. "delay": "",
    12. "history": "90d",
    13. "trends": "365d",
    14. "status": "0",
    15. "value_type": "3",
    16. "trapper_hosts": "",
    17. "units": "",
    18. "formula": "",
    19. "error": "",
    20. "logtimefmt": "",
    21. "templateid": "0",
    22. "valuemapid": "0",
    23. "params": "",
    24. "ipmi_sensor": "",
    25. "authtype": "0",
    26. "username": "",
    27. "password": "",
    28. "publickey": "",
    29. "privatekey": "",
    30. "flags": "0",
    31. "interfaceid": "0",
    32. "description": "",
    33. "inventory_link": "0",
    34. "lifetime": "30d",
    35. "state": "0",
    36. "evaltype": "0",
    37. "master_itemid": "25545",
    38. "jmx_endpoint": "",
    39. "timeout": "3s",
    40. "url": "",
    41. "query_fields": [],
    42. "posts": "",
    43. "status_codes": "200",
    44. "follow_redirects": "1",
    45. "post_type": "0",
    46. "http_proxy": "",
    47. "headers": [],
    48. "retrieve_mode": "0",
    49. "request_method": "0",
    50. "output_format": "0",
    51. "ssl_cert_file": "",
    52. "ssl_key_file": "",
    53. "ssl_key_password": "",
    54. "verify_peer": "0",
    55. "verify_host": "0",
    56. "allow_traps": "0",
    57. "lastclock": "0",
    58. "lastns": "0",
    59. "lastvalue": "0",
    60. "prevvalue": "0",
    61. "parameters": []
    62. },
    63. {
    64. "itemid": "25555",
    65. "type": "18",
    66. "hostid": "10116",
    67. "name": "Hours",
    68. "key_": "apache.status.uptime.hours",
    69. "delay": "0",
    70. "history": "90d",
    71. "trends": "365d",
    72. "status": "0",
    73. "value_type": "3",
    74. "trapper_hosts": "",
    75. "units": "",
    76. "formula": "",
    77. "error": "",
    78. "templateid": "0",
    79. "valuemapid": "0",
    80. "params": "",
    81. "ipmi_sensor": "",
    82. "authtype": "0",
    83. "username": "",
    84. "password": "",
    85. "publickey": "",
    86. "privatekey": "",
    87. "flags": "0",
    88. "interfaceid": "0",
    89. "description": "",
    90. "inventory_link": "0",
    91. "lifetime": "30d",
    92. "state": "0",
    93. "evaltype": "0",
    94. "master_itemid": "25545",
    95. "jmx_endpoint": "",
    96. "timeout": "3s",
    97. "url": "",
    98. "query_fields": [],
    99. "posts": "",
    100. "status_codes": "200",
    101. "follow_redirects": "1",
    102. "post_type": "0",
    103. "http_proxy": "",
    104. "headers": [],
    105. "retrieve_mode": "0",
    106. "request_method": "0",
    107. "output_format": "0",
    108. "ssl_cert_file": "",
    109. "ssl_key_file": "",
    110. "ssl_key_password": "",
    111. "verify_peer": "0",
    112. "verify_host": "0",
    113. "allow_traps": "0",
    114. "lastclock": "0",
    115. "lastns": "0",
    116. "lastvalue": "0",
    117. "prevvalue": "0",
    118. "parameters": []
    119. }
    120. ],
    121. "id": 1
    122. }

    Find HTTP agent item

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "28252",
    6. "type": "19",
    7. "snmp_oid": "",
    8. "hostid": "10255",
    9. "name": "template item",
    10. "key_": "ti",
    11. "delay": "30s",
    12. "history": "90d",
    13. "trends": "365d",
    14. "status": "0",
    15. "value_type": "3",
    16. "trapper_hosts": "",
    17. "units": "",
    18. "formula": "",
    19. "error": "",
    20. "logtimefmt": "",
    21. "templateid": "0",
    22. "valuemapid": "0",
    23. "params": "",
    24. "ipmi_sensor": "",
    25. "authtype": "0",
    26. "username": "",
    27. "password": "",
    28. "publickey": "",
    29. "privatekey": "",
    30. "flags": "0",
    31. "interfaceid": "0",
    32. "description": "",
    33. "inventory_link": "0",
    34. "lifetime": "30d",
    35. "state": "0",
    36. "evaltype": "0",
    37. "jmx_endpoint": "",
    38. "master_itemid": "0",
    39. "timeout": "3s",
    40. "url": "localhost",
    41. "query_fields": [
    42. {
    43. "mode": "xml"
    44. }
    45. ],
    46. "posts": "<body>\r\n<![CDATA[{$MACRO}<foo></bar>]]>\r\n</body>",
    47. "status_codes": "200",
    48. "follow_redirects": "0",
    49. "post_type": "3",
    50. "http_proxy": "",
    51. "headers": [],
    52. "retrieve_mode": "1",
    53. "request_method": "3",
    54. "output_format": "0",
    55. "ssl_cert_file": "",
    56. "ssl_key_file": "",
    57. "ssl_key_password": "",
    58. "verify_peer": "0",
    59. "verify_host": "0",
    60. "allow_traps": "0",
    61. "lastclock": "0",
    62. "lastns": "0",
    63. "lastvalue": "0",
    64. "prevvalue": "0",
    65. "parameters": []
    66. }
    67. ],
    68. "id": 3
    69. }

    Retrieving items with preprocessing rules

    Reatrieve all items and their preprocessing rules from host with ID “10254”.

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "itemid": "23865",
    5. "name": "http agent example JSON",
    6. "key_": "json",
    7. "preprocessing": [
    8. {
    9. "type": "12",
    10. "params": "$.random",
    11. "error_handler": "1",
    12. "error_handler_params": ""
    13. }
    14. ]
    15. },
    16. "id": 1
    17. }

    Source