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

批量删除

描述

object hostinterface.massremove(object parameters)

此方法允许删除给定主机的主机接口.

参数

(对象) 包含要更新的主机的ID和要删除的接口的参数.

参数 类 描述
hostids
(必选)
对象/数组 要更新 主机ID.
interfaces
(必选)
对象/数组 从给定
主机中删除主机接口.
主机接口对象必须已定义ip,dns和port属性

返回值

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

示例

删除接口

从给定的两台主机中删除"127.0.0.1" SNMP接口.

请求:

{
           "jsonrpc": "2.0",
           "method": "hostinterface.massremove",
           "params": {
               "hostids": [
                   "30050",
                   "30052"
               ],
               "interfaces": {
                   "dns": "",
                   "ip": "127.0.0.1",
                   "port": "161"
               }
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

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

参考

* 

来源

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