object hostinterface.massremove(object parameters)
此方法允许从给定的 主机 中移除 主机 接口。
此方法仅对 Admin 和 Super admin 用户类型可用。调用该方法的权限可以在用户角色设置中撤销。更多信息请参见 User roles。
(object)
参数包含要更新的 主机 的 ID 和 要移除的接口。
参数 | 数据类型 | 描述 |
---|---|---|
interfaces | object/array | 要从给定的 主机 中移除的 Host interfaces。 主机 接口 object 必须仅定义 ip 、dns 和 port 属性。参数行为: - 必填 |
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
}
响应:
CHostInterface::massRemove() 函数位于 ui/include/classes/api/services/CHostInterface.php 文件中。