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

更新

描述

object hostinterface.update(object/array hostInterfaces)

此方法允许更新已存在的主机接口

参数

(对象/数组) 要更新的主机接口属性.

必须为每个主机接口定义interfaceid属性,所有其他属性都是可选的。 只有给定的属性将被更新,所有其他属性将保持不变.

返回值

(对象)interfaceids属性中返回已更新主机接口ID的对象.

示例

更改主机接口端口

更改主机接口的端口.

请求:

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

响应:

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

来源

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