This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

hostprototype.get

Description

integer/array hostprototype.get(object parameters)

The method allows to retrieve host prototypes according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
hostids string/array Return only host prototypes with the given IDs.
discoveryids string/array Return only host prototype that belong to the given LLD rules.
inherited boolean If set to true return only items inherited from a template.
selectDiscoveryRule query Return the LLD rule that the host prototype belongs to in the discoveryRule property.
selectGroupLinks query Return the group links of the host prototype in the groupLinks property.
selectGroupPrototypes query Return the group prototypes of the host prototype in the groupPrototypes property.
selectInventory query Return the host prototype inventory in the inventory property.
selectParentHost query Return the host that the host prototype belongs to in the parentHost property.
selectTemplates query Return the templates linked to the host prototype in the templates property.
sortfield string/array Sort the result by the given properties.

Possible values are: hostid, host, name and status.
countOutput flag These parameters being common for all get methods are described in detail on the Generic Zabbix API information page.
editable boolean
excludeSearch flag
filter object
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 host prototypes from an LLD rule

Retrieve all host prototypes and their group links and group prototypes from an LLD rule.

Request:

{
           "jsonrpc": "2.0",
           "method": "hostprototype.get",
           "params": {
               "output": "extend",
               "selectGroupLinks": "extend",
               "selectGroupPrototypes": "extend",
               "discoveryids": "23554"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "hostid": "10092",
                   "host": "{#HV.UUID}",
                   "status": "0",
                   "name": "{#HV.NAME}",
                   "templateid": "0",
                   "tls_connect": "1",
                   "tls_accept": "1",
                   "tls_issuer": "",
                   "tls_subject": "",
                   "tls_psk_identity": "",
                   "tls_psk": "",
                   "groupLinks": [
                       {
                           "group_prototypeid": "4",
                           "hostid": "10092",
                           "groupid": "7",
                           "templateid": "0"
                       }
                   ],
                   "groupPrototypes": [
                       {
                           "group_prototypeid": "7",
                           "hostid": "10092",
                           "name": "{#CLUSTER.NAME}",
                           "templateid": "0"
                       }
                   ]
               }
           ],
           "id": 1
       }

See also

Source

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