Zabbix Documentation 4.0

3.04.04.24.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.4Guidelines

User Tools

Site Tools


Sidebar

manual:api:reference:hostinterface:replacehostinterfaces

hostinterface.replacehostinterfaces

Description

object hostinterface.replacehostinterfaces(object parameters)

This method allows to replace all host interfaces on a given host.

Parameters

(object) Parameters containing the ID of the host to be updated and the new host interfaces.

Parameter Type Description
hostid
(required)
string ID of the host to be updated.
interfaces
(required)
object/array Host interfaces to replace the current host interfaces with.

Return values

(object) Returns an object containing the IDs of the created host interfaces under the interfaceids property.

Examples

Replacing host interfaces

Replace all host interfaces with a single agent interface.

Request:

{
    "jsonrpc": "2.0",
    "method": "hostinterface.replacehostinterfaces",
    "params": {
        "hostid": "30052",
        "interfaces": {
            "dns": "",
            "ip": "127.0.0.1",
            "main": 1,
            "port": "10050",
            "type": 1,
            "useip": 1
        }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "interfaceids": [
            "30081"
        ]
    },
    "id": 1
}

See also

Source

CHostInterface::replaceHostInterfaces() in frontends/php/include/classes/api/services/CHostInterface.php.