manual:api:reference:host: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
Next revision Both sides next revision
manual:api:reference:host:get [2020/05/05 11:31]
martins-v frontends/php -> ui (ZBX-17667)
manual:api:reference:host:get [2021/02/23 13:27]
gcalenko ZBXNEXT-5868: removed note about count support
Line 6: Line 6:
  
 The method allows to retrieve hosts according to the given parameters. The method allows to retrieve hosts according to the given parameters.
 +
 +<​note>​This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See [[:​manual/​web_interface/​frontend_sections/​administration/​user_roles|User roles]] for more information.</​note>​
  
 ==== Parameters ==== ==== Parameters ====
Line 13: Line 15:
 The method supports the following parameters. The method supports the following parameters.
  
-^Parameter^Type^Description^+^Parameter^[[:​manual/​api/​reference_commentary#​data_types|Type]]^Description^
 |groupids|string/​array| Return only hosts that belong to the given groups. |  |groupids|string/​array| Return only hosts that belong to the given groups. | 
 |applicationids|string/​array| Return only hosts that have the given applications. | |applicationids|string/​array| Return only hosts that have the given applications. |
Line 45: Line 47:
 |evaltype|integer|Rules for tag searching. \\ \\ Possible values: \\ 0 - (default) And/Or; \\ 2 - Or. | |evaltype|integer|Rules for tag searching. \\ \\ Possible values: \\ 0 - (default) And/Or; \\ 2 - Or. |
 |severities|integer/​array|Return hosts that have only problems with given severities. Applies only if problem object is trigger. | |severities|integer/​array|Return hosts that have only problems with given severities. Applies only if problem object is trigger. |
-|tags|array/​object|Return only hosts with given tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value. \\ Format: ''<​nowiki>​[{"​tag":​ "<​tag>",​ "​value":​ "<​value>",​ "​operator":​ "<​operator>"​},​ ...]</​nowiki>''​.\\ An empty array returns all hosts. \\ \\ Possible operator values: \\ 0 - (default) Contains; \\ 1 - Equals. |+|tags|array/​object|Return only hosts with given tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value. \\ Format: ''<​nowiki>​[{"​tag":​ "<​tag>",​ "​value":​ "<​value>",​ "​operator":​ "<​operator>"​},​ ...]</​nowiki>''​.\\ An empty array returns all hosts. \\ \\ Possible operator values: \\ 0 - (default) Contains; \\ 1 - Equals; \\ 2 - Not like; \\ 3 - Not equal \\ 4 - Exists; \\ 5 - Not exists. |
 |inheritedTags|boolean|Return hosts that have given ''​tags''​ also in all of their linked templates. Default: \\ \\ Possible values: \\ ''​true''​ - linked templates must also have given ''​tags'';​ \\ ''​false''​ - (default) linked template tags are ignored. | |inheritedTags|boolean|Return hosts that have given ''​tags''​ also in all of their linked templates. Default: \\ \\ Possible values: \\ ''​true''​ - linked templates must also have given ''​tags'';​ \\ ''​false''​ - (default) linked template tags are ignored. |
 ^  ||| ^  |||
Line 60: Line 62:
 |selectMacros|query|Return a ''​[[:​manual/​api/​reference/​usermacro/​object|macros]]''​ property with host macros. ​ | |selectMacros|query|Return a ''​[[:​manual/​api/​reference/​usermacro/​object|macros]]''​ property with host macros. ​ |
 |selectParentTemplates|query|Return a ''​[[:​manual/​api/​reference/​template/​object|parentTemplates]]''​ property with templates that the host is linked to.\\ \\ Supports ''​count''​. | |selectParentTemplates|query|Return a ''​[[:​manual/​api/​reference/​template/​object|parentTemplates]]''​ property with templates that the host is linked to.\\ \\ Supports ''​count''​. |
-|selectScreens|query|Return a ''​[[:​manual/​api/​reference/​screen/object|screens]]''​ property ​with host screens.\\ \\ Supports ''​count''​. |+|selectDashboards ​| query | Return a ''​[[:​manual/​api/​reference/​templatedashboard/object|dashboards]]''​ property. \\ \\ Supports ''​count''​. |
 |selectTags|query|Return a ''​[[:​manual/​api/​reference/​host/​object#​host_tag|tags]]''​ property with host tags. | |selectTags|query|Return a ''​[[:​manual/​api/​reference/​host/​object#​host_tag|tags]]''​ property with host tags. |
 |selectInheritedTags|query| Return an ''​[[:​manual/​api/​reference/​host/​object#​host_tag|inheritedTags]]''​ property with tags that are on all templates which are linked to host. | |selectInheritedTags|query| Return an ''​[[:​manual/​api/​reference/​host/​object#​host_tag|inheritedTags]]''​ property with tags that are on all templates which are linked to host. |
 |selectTriggers|query|Return a ''​[[:​manual/​api/​reference/​trigger/​object|triggers]]''​ property with host triggers.\\ \\ Supports ''​count''​. | |selectTriggers|query|Return a ''​[[:​manual/​api/​reference/​trigger/​object|triggers]]''​ property with host triggers.\\ \\ Supports ''​count''​. |
 +|selectValueMaps|query|Return a ''​[[:​manual/​api/​reference/​valuemap/​object|valuemaps]]''​ property with host value maps. |
 ^  ||| ^  |||
 |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. \\ \\ Allows filtering by interface properties. | |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. \\ \\ Allows filtering by interface properties. |
-| limitSelects | integer | Limits the number of records returned by subselects. \\  \\ Applies to the following subselects: \\ ''​selectParentTemplates''​ - results will be sorted by ''​host'';​ \\ ''​selectInterfaces'';​ \\ ''​selectItems''​ - sorted by ''​name'';​ \\ ''​selectDiscoveries''​ - sorted by ''​name'';​ \\ ''​selectTriggers''​ - sorted by ''​description'';​ \\ ''​selectGraphs''​ - sorted by ''​name'';​ \\ ''​selectApplications''​ - sorted by ''​name'';​ \\ ''​selectScreens''​ - sorted by ''​name''​. |+| limitSelects | integer | Limits the number of records returned by subselects. \\  \\ Applies to the following subselects: \\ ''​selectParentTemplates''​ - results will be sorted by ''​host'';​ \\ ''​selectInterfaces'';​ \\ ''​selectItems''​ - sorted by ''​name'';​ \\ ''​selectDiscoveries''​ - sorted by ''​name'';​ \\ ''​selectTriggers''​ - sorted by ''​description'';​ \\ ''​selectGraphs''​ - sorted by ''​name'';​ \\ ''​selectApplications''​ - sorted by ''​name'';​ \\ ''​selectDashboards''​ - sorted by ''​name''​. |
 |search ​ | object |Return results that match the given wildcard search.\\ \\ Accepts an array, where the keys are property names, and the values are strings to search for. If no additional options are given, this will perform a ''​LIKE "​%…%"''​ search.\\ \\ Allows searching by interface properties. Works only with text fields. | |search ​ | object |Return results that match the given wildcard search.\\ \\ Accepts an array, where the keys are property names, and the values are strings to search for. If no additional options are given, this will perform a ''​LIKE "​%…%"''​ search.\\ \\ Allows searching by interface properties. Works only with text fields. |
 |searchInventory | object | Return only hosts that have inventory data matching the given wildcard search. \\ \\ This parameter is affected by the same additional parameters as ''​search''​. | |searchInventory | object | Return only hosts that have inventory data matching the given wildcard search. \\ \\ This parameter is affected by the same additional parameters as ''​search''​. |
Line 121: Line 124:
             "​host":​ "​Zabbix server",​             "​host":​ "​Zabbix server",​
             "​status":​ "​0",​             "​status":​ "​0",​
-            "​disable_until":​ "​0",​ 
-            "​error":​ "",​ 
-            "​available":​ "​0",​ 
-            "​errors_from":​ "​0",​ 
             "​lastaccess":​ "​0",​             "​lastaccess":​ "​0",​
             "​ipmi_authtype":​ "​-1",​             "​ipmi_authtype":​ "​-1",​
Line 131: Line 130:
             "​ipmi_password":​ "",​             "​ipmi_password":​ "",​
             "​ipmi_disable_until":​ "​0",​             "​ipmi_disable_until":​ "​0",​
-            "​ipmi_available":​ "​0",​ 
             "​snmp_disable_until":​ "​0",​             "​snmp_disable_until":​ "​0",​
-            "​snmp_available":​ "​0",​ 
             "​maintenanceid":​ "​0",​             "​maintenanceid":​ "​0",​
             "​maintenance_status":​ "​0",​             "​maintenance_status":​ "​0",​
             "​maintenance_type":​ "​0",​             "​maintenance_type":​ "​0",​
             "​maintenance_from":​ "​0",​             "​maintenance_from":​ "​0",​
-            "​ipmi_errors_from":​ "​0",​ 
-            "​snmp_errors_from":​ "​0",​ 
-            "​ipmi_error":​ "",​ 
-            "​snmp_error":​ "",​ 
-            "​jmx_disable_until":​ "​0",​ 
-            "​jmx_available":​ "​0",​ 
-            "​jmx_errors_from":​ "​0",​ 
-            "​jmx_error":​ "",​ 
             "​name":​ "​Zabbix server",​             "​name":​ "​Zabbix server",​
             "​description":​ "The Zabbix monitoring server.",​             "​description":​ "The Zabbix monitoring server.",​
Line 151: Line 140:
             "​tls_accept":​ "​1",​             "​tls_accept":​ "​1",​
             "​tls_issuer":​ "",​             "​tls_issuer":​ "",​
-            "​tls_subject": "",​ +            "​tls_subject":​ ""​
-            "​tls_psk_identity":​ "",​ +
-            "​tls_psk": ""​+
         },         },
         {         {
Line 161: Line 148:
             "​host":​ "Linux server",​             "​host":​ "Linux server",​
             "​status":​ "​0",​             "​status":​ "​0",​
-            "​disable_until":​ "​0",​ 
-            "​error":​ "",​ 
-            "​available":​ "​0",​ 
-            "​errors_from":​ "​0",​ 
             "​lastaccess":​ "​0",​             "​lastaccess":​ "​0",​
             "​ipmi_authtype":​ "​-1",​             "​ipmi_authtype":​ "​-1",​
Line 171: Line 154:
             "​ipmi_password":​ "",​             "​ipmi_password":​ "",​
             "​ipmi_disable_until":​ "​0",​             "​ipmi_disable_until":​ "​0",​
-            "​ipmi_available":​ "​0",​ 
             "​snmp_disable_until":​ "​0",​             "​snmp_disable_until":​ "​0",​
-            "​snmp_available":​ "​0",​ 
             "​maintenanceid":​ "​0",​             "​maintenanceid":​ "​0",​
             "​maintenance_status":​ "​0",​             "​maintenance_status":​ "​0",​
             "​maintenance_type":​ "​0",​             "​maintenance_type":​ "​0",​
             "​maintenance_from":​ "​0",​             "​maintenance_from":​ "​0",​
-            "​ipmi_errors_from":​ "​0",​ 
-            "​snmp_errors_from":​ "​0",​ 
-            "​ipmi_error":​ "",​ 
-            "​snmp_error":​ "",​ 
-            "​jmx_disable_until":​ "​0",​ 
-            "​jmx_available":​ "​0",​ 
-            "​jmx_errors_from":​ "​0",​ 
-            "​jmx_error":​ "",​ 
             "​name":​ "Linux server",​             "​name":​ "Linux server",​
             "​description":​ "",​             "​description":​ "",​
Line 191: Line 164:
             "​tls_accept":​ "​1",​             "​tls_accept":​ "​1",​
             "​tls_issuer":​ "",​             "​tls_issuer":​ "",​
-            "​tls_subject": "",​ +            "​tls_subject":​ ""​
-            "​tls_psk_identity":​ "",​ +
-            "​tls_psk": ""​+
         }         }
     ],     ],
Line 280: Line 251:
             "​parentTemplates":​ [             "​parentTemplates":​ [
                 {                 {
-                    "​name":​ "Template OS Linux",​+                    "​name":​ "​Linux",​
                     "​templateid":​ "​10001"​                     "​templateid":​ "​10001"​
                 },                 },
                 {                 {
-                    "​name":​ "Template App Zabbix Server",​+                    "​name":​ "​Zabbix Server",​
                     "​templateid":​ "​10047"​                     "​templateid":​ "​10047"​
                 }                 }