On this page
host.getobjects
Description
array host.getobjects(object filter)
This method allows to retrieve hosts that match the given filter criteria.
Parameters
(object) Criteria to search by.
Additionally to the standard standard host properties the following parameters are supported as search criteria.
| Parameter | Type | Description |
|---|---|---|
| node | string | Name of the node the hosts must belong to. This will override the nodeids parameter. |
| nodeids | string/array | ID of the node the hosts must belong to. |
Return values
(array) Returns an array of objects with all properties.
Examples
Retrieving a host by name
Retrieve the host with the technical name "Zabbix server".
Request:
{
"jsonrpc": "2.0",
"method": "host.getobjects",
"params": {
"name": "Zabbix server"
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"maintenances": [],
"hostid": "10084",
"proxy_hostid": "0",
"host": "Zabbix server",
"status": "0",
"disable_until": "0",
"error": "",
"available": "1",
"errors_from": "0",
"lastaccess": "0",
"ipmi_authtype": "-1",
"ipmi_privilege": "2",
"ipmi_username": "",
"ipmi_password": "",
"ipmi_disable_until": "0",
"ipmi_available": "0",
"snmp_disable_until": "0",
"snmp_available": "0",
"maintenanceid": "0",
"maintenance_status": "0",
"maintenance_type": "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"
}
],
"id": 1
}
See also
Source
CHost::getObject() in frontends/php/api/classes/CHost.php.