On this page
hostinterface.exists
Description
boolean hostinterface.exists(object filter)
This method checks if at least one host interface that matches the given filter criteria exists.
Parameters
(object) Criteria to search by.
The following parameters are supported as search criteria.
| Parameter | Type | Description |
|---|---|---|
| dns | string/array | DNS of the host interfaces. |
| hostid | string/array | IDs of the hosts that the host interfaces must belong to. |
| interfaceid | string/array | Host interface IDs. |
| ip | string/array | IPs of the host interfaces. |
| node | string | Name of the node the host interfaces must belong to. This will override the nodeids parameter. |
| nodeids | string/array | IDs of the node the host interfaces must belong to. |
Return values
(boolean) Returns true if at least one host interface that matches
the given filter criteria exists.
Examples
Check interface on host
Check if a host interface with IP 127.0.0.1 exists on host 30037.
Request:
{
"jsonrpc": "2.0",
"method": "hostinterface.exists",
"params": {
"hostid": "30037",
"ip": "127.0.0.1"
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": true,
"id": 1
}
Source
CHostInterface::exists() in frontends/php/api/classes/CHostInterface.php.