hostinterface.massremove

描述

object hostinterface.massremove(object parameters)

此方法允许从给定的 主机 中移除 主机 接口。

此方法仅对 AdminSuper admin 用户类型可用。调用该方法的权限可以在用户角色设置中撤销。更多信息请参见 User roles

参数

(object) 参数包含要更新的 主机 的 ID 和 要移除的接口。

参数 数据类型 描述
interfaces object/array 要从给定的 主机 中移除的 Host interfaces

主机 接口 object 必须仅定义 ipdnsport 属性。

参数行为
- 必填
hostids ID/array 要更新的 主机 的 ID。

参数行为
- 必填

返回值

(object) 返回一个 object,其中包含已删除的 主机 接口的 ID,这些 ID 位于 interfaceids 属性下。

示例

移除接口

从两个 主机 中移除 "127.0.0.1" SNMP 接口。

执行请求:

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

响应:

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

另请参阅

来源

CHostInterface::massRemove() 函数位于 ui/include/classes/api/services/CHostInterface.php 文件中。