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.该方法支持以下参数。
参数 | 类型 | 描述 |
---|---|---|
hostids | string/array | Return only host prototypes with the given IDs.只返回具有给定ID的主机原型 |
discoveryids | string/array | Return only host prototype that belong to the given LLD rules.仅返回属于给定LLD规则的主机原型。 |
inherited | boolean | If set to true return only items inherited from a template.如果设置为“true”,只返回从模板继承的项目。 |
selectDiscoveryRule | query | Return the LLD rule that the host prototype belongs to in the discoveryRule property.在“discoveryRule”属性中返回主机原型所属的LLD规则。 |
selectGroupLinks | query | Return the group links of the host prototype in the groupLinks property.在“groupLinks”属性中返回主机原型的组链接。 |
selectGroupPrototypes | query | Return the group prototypes of the host prototype in the groupPrototypes property.返回“groupPrototypes”属性中的主机原型的组原型。 |
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. 在“parentHost”属性中返回主机原型所属的主机。 |
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 . 可能的值是:'hostid,'host ,name 和status 。 |
countOutput | flag | These parameters being common for all get methods are described in detail on the Generic Zabbix API information page.通用Zabbix API信息页面详细描述了所有“get”方法的这些参数。 |
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.如果已经使用“countOutput”参数,则检索到的对象的计数。
Examples 示例
Retrieving host prototypes from an LLD rule从LLD规则检索主机原型
Retrieve all host prototypes and their group links and group prototypes from an LLD rule.从LLD规则中检索所有主机原型及其组链接和组原型。
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.