Zabbix Documentation 4.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:api:reference:item:get

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:api:reference:item:get [2018/07/20 15:00]
gcalenko ZBXNEXT-4611: request_method default value change
manual:api:reference:item:get [2019/08/14 06:44] (current)
miks.kronkalns Renamed "Check for error in regular expression" to "Check for error using regular expression"
Line 32: Line 32:
 | with_triggers | boolean | If set to ''​true''​ return only items that are used in triggers. | | with_triggers | boolean | If set to ''​true''​ return only items that are used in triggers. |
 ^ ||| ^ |||
-| selectHosts | query | Returns the host that the item belongs to as an array in the ''​hosts''​ property. | +| selectHosts | query | Return a ''​[[:​manual/​api/​reference/​host/​object|hosts]]''​ property ​with an array of hosts that the item belongs to 
-| selectInterfaces | query | Returns the host interface used by the item as an array in the ''​interfaces''​ property. | +| selectInterfaces | query | Return ​an ''​[[:​manual/​api/​reference/​hostinterface/​object|interfaces]]''​ property ​with an array of host interfaces used by the item 
-| selectTriggers | query | Return triggers that the item is used in in the ''​triggers''​ property. \\ \\ Supports ''​count''​. | +| selectTriggers | query | Return ​a ''​[[:​manual/​api/​reference/​trigger/​object|triggers]]''​ property with the triggers that the item is used in.\\ \\ Supports ''​count''​. ​ 
-| selectGraphs | query | Return ​graphs that contain the item in the ''​graphs''​ property. \\ \\ Supports ''​count''​. | +| selectGraphs | query | Return ​''​[[:​manual/​api/​reference/​graph/​object|graphs]]''​ property ​with the graphs that contain the item.\\ \\ Supports ''​count''​. ​ 
-| selectApplications | query | Return the applications that the item belongs to in the ''​applications''​ property. | +| selectApplications | query | Return ​an ''​[[:​manual/​api/​reference/​application/​object|applications]]''​ property with the applications that the item belongs to.  
-| selectDiscoveryRule | query | Return the LLD rule that created the item in the ''​discoveryRule''​ property. | +| selectDiscoveryRule | query | Return ​a ''​[[:​manual/​api/​reference/​drule/​object|discoveryRule]]''​ property with the LLD rule that created the item. | 
-| selectItemDiscovery | query | Return ​the item discovery object in the ''​itemDiscovery''​ property. The item discovery object links the item to an item prototype from which it was created. \\ \\  It has the following properties: \\ ''​itemdiscoveryid''​ - ''​(string)''​ ID of the item discovery; \\ ''​itemid''​ - ''​(string)''​ ID of the discovered item; \\ ''​parent_itemid''​ - ''​(string)''​ ID of the item prototype from which the item has been created; \\ ''​key_''​ - ''​(string)''​ key of the item prototype; \\ ''​lastcheck''​ - ''​(timestamp)''​ time when the item was last discovered; \\ ''​ts_delete''​ - ''​(timestamp)''​ time when an item that is no longer discovered will be deleted. | +| selectItemDiscovery | query | Return ​an ''​itemDiscovery''​ property ​with the item discovery object. The item discovery object links the item to an item prototype from which it was created. \\ \\  It has the following properties: \\ ''​itemdiscoveryid''​ - ''​(string)''​ ID of the item discovery; \\ ''​itemid''​ - ''​(string)''​ ID of the discovered item; \\ ''​parent_itemid''​ - ''​(string)''​ ID of the item prototype from which the item has been created; \\ ''​key_''​ - ''​(string)''​ key of the item prototype; \\ ''​lastcheck''​ - ''​(timestamp)''​ time when the item was last discovered; \\ ''​ts_delete''​ - ''​(timestamp)''​ time when an item that is no longer discovered will be deleted. | 
-| selectPreprocessing | query | Return ​item preprocessing options in ''​preprocessing''​ property. \\ \\ It has the following properties: \\ ''​type''​ - ''​(string)''​ The preprocessing option ​types: \\ 1 - Custom multiplier; \\ 2 - Right trim; \\ 3 - Left trim; \\ 4 - Trim; \\ 5 - Regular expression matching; \\ 6 - Boolean to decimal; \\ 7 - Octal to decimal; \\ 8 - Hexadecimal to decimal; \\ 9 - Simple change; \\ 10 - Change per second. \\ \\ ''​params''​ - ''​(string)''​ Additional parameters used by preprocessing option. Multiple parameters are separated by LF (\n)character. |+| selectPreprocessing | query | Return ​''​preprocessing''​ property ​with item preprocessing options.\\ \\ It has the following properties: \\ ''​type''​ - ''​(string)''​ The preprocessing option ​type: \\ 1 - Custom multiplier; \\ 2 - Right trim; \\ 3 - Left trim; \\ 4 - Trim; \\ 5 - Regular expression matching; \\ 6 - Boolean to decimal; \\ 7 - Octal to decimal; \\ 8 - Hexadecimal to decimal; \\ 9 - Simple change; \\ 10 - Change per second; \\ 11 - XML XPath; \\ 12 - JSONPath; \\ 13 - In range; \\ 14 - Matches regular expression; \\ 15 - Does not match regular expression; \\ 16 - Check for error in JSON; \\ 17 - Check for error in XML; \\ 18 - Check for error using regular expression; \\ 19 - Discard unchanged; \\ 20 - Discard unchanged with heartbeat; \\ 21 - JavaScript; \\ 22 - Prometheus pattern; \\ 23 - Prometheus to JSON. \\ \\ ''​params''​ - ''​(string)''​ Additional parameters used by preprocessing option. Multiple parameters are separated by LF (\n)character. \\ ''​error_handler''​ - ''​(string)''​ Action type used in case of preprocessing step failure: \\ 0 - Error message is set by Zabbix server; \\ 1 - Discard value; \\ 2 - Set custom value; \\ 3 - Set custom error message. \\ \\ ''​error_handler_params''​ - ''​(string)''​ Error handler parameters. |
 ^ ||| ^ |||
 |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 belongs to. | |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 belongs to. |
Line 68: Line 68:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 86: Line 86:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 117: Line 117:
             "​snmpv3_contextname":​ "",​             "​snmpv3_contextname":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​22680",​             "​templateid":​ "​22680",​
Line 128: Line 127:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​lastns":​ "​564054253",​             "​lastns":​ "​564054253",​
             "​flags":​ "​0",​             "​flags":​ "​0",​
Line 185: Line 183:
             "​snmpv3_contextname":​ "",​             "​snmpv3_contextname":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​17354",​             "​templateid":​ "​17354",​
Line 196: Line 193:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​lastns":​ "​564256864",​             "​lastns":​ "​564256864",​
             "​flags":​ "​0",​             "​flags":​ "​0",​
Line 252: Line 248:
             "​snmpv3_contextname":​ "",​             "​snmpv3_contextname":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​22671",​             "​templateid":​ "​22671",​
Line 263: Line 258:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​lastns":​ "​564661387",​             "​lastns":​ "​564661387",​
             "​flags":​ "​0",​             "​flags":​ "​0",​
Line 303: Line 297:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 323: Line 317:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 348: Line 342:
             "​formula":​ "",​             "​formula":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​0",​             "​templateid":​ "​0",​
Line 359: Line 352:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​flags":​ "​0",​             "​flags":​ "​0",​
             "​interfaceid":​ "​0",​             "​interfaceid":​ "​0",​
Line 383: Line 375:
             "​headers":​ [],             "​headers":​ [],
             "​retrieve_mode":​ "​0",​             "​retrieve_mode":​ "​0",​
-            "​request_method":​ "1",+            "​request_method":​ "0",
             "​output_format":​ "​0",​             "​output_format":​ "​0",​
             "​ssl_cert_file":​ "",​             "​ssl_cert_file":​ "",​
Line 417: Line 409:
             "​formula":​ "",​             "​formula":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​0",​             "​templateid":​ "​0",​
Line 428: Line 419:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​flags":​ "​0",​             "​flags":​ "​0",​
             "​interfaceid":​ "​0",​             "​interfaceid":​ "​0",​
Line 452: Line 442:
             "​headers":​ [],             "​headers":​ [],
             "​retrieve_mode":​ "​0",​             "​retrieve_mode":​ "​0",​
-            "​request_method":​ "1",+            "​request_method":​ "0",
             "​output_format":​ "​0",​             "​output_format":​ "​0",​
             "​ssl_cert_file":​ "",​             "​ssl_cert_file":​ "",​
Line 476: Line 466:
 Request: Request:
  
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 494: Line 484:
 Response: Response:
  
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 519: Line 509:
             "​formula":​ "",​             "​formula":​ "",​
             "​error":​ "",​             "​error":​ "",​
-            "​lastlogsize":​ "​0",​ 
             "​logtimefmt":​ "",​             "​logtimefmt":​ "",​
             "​templateid":​ "​0",​             "​templateid":​ "​0",​
Line 530: Line 519:
             "​publickey":​ "",​             "​publickey":​ "",​
             "​privatekey":​ "",​             "​privatekey":​ "",​
-            "​mtime":​ "​0",​ 
             "​flags":​ "​0",​             "​flags":​ "​0",​
             "​interfaceid":​ "​0",​             "​interfaceid":​ "​0",​
Line 575: Line 563:
 } }
 </​code>​ </​code>​
 +
 +=== Retrieving items with preprocessing rules ===
 +Reatrieve all items and their preprocessing rules from host with ID "​10254"​.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​item.get",​
 +    "​params":​ {
 +        "​output":​ ["​itemid",​ "​name",​ "​key_"​],​
 +        "​selectPreprocessing":​ "​extend",​
 +        "​hostids":​ "​10254"​
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​itemid":​ "​23865",​
 +        "​name":​ "http agent example JSON",
 +        "​key_":​ "​json",​
 +        "​preprocessing":​ [
 +            {
 +                "​type":​ "​12",​
 +                "​params":​ "​$.random",​
 +                "​error_handler":​ "​1",​
 +                "​error_handler_params":​ ""​
 +            }
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 ==== See also ==== ==== See also ====