2022 Zabbix中国峰会
2022 Zabbix中国峰会

hostinterface.update

Description 说明

object hostinterface.update(object/array hostInterfaces)

This method allows to update existing host interfaces.此方法允许更新现有的主机接口。

Parameters 参数

(object/array) Host interface properties to be updated.更新的主机接口属性。

The interfaceid property must be defined for each host interface, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.必须为每个主机接口定义“interfaceid”属性,所有其他属性都是可选的。 只有给定的属性将被更新,所有其他属性将保持不变。

Return values 返回值

(object) Returns an object containing the IDs of the updated host interfaces under the interfaceids property.返回一个包含“interfaceids”属性下更新的主机接口的ID的对象

Examples 示例

Changing a host interface port更改主机接口端口

Change the port of a host interface.更改主机接口的端口。

Request:

{
           "jsonrpc": "2.0",
           "method": "hostinterface.update",
           "params": {
               "interfaceid": "30048",
               "port": "30050"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

Source 来源

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