host.massremove

描述

object host.massremove(object parameters)

此方法允许从多个主机中移除关联的objects。

此方法仅适用于管理员超级管理员用户类型。调用该方法的权限可在用户角色设置中撤销。更多信息请参阅User roles

参数

(object) 参数包含需要更新的主机ID以及应移除的objects。

参数 数据类型 描述
hostids
(required)
string/array 待更新的主机ID。
groupids string/array 需要从中移除指定主机的主机组。
interfaces object/array 需要从指定主机中移除的主机接口。

主机接口object必须定义ipdnsport属性。
macros string/array 需要从指定主机中删除的用户宏。
templateids string/array 需要从指定主机中解关联的模板。
templateids_clear string/array 需要从指定主机中解关联并清除的模板。

返回值

(object) 返回一个包含更新后的hostids属性下主机 ID的object。

示例

解除模板关联

从两个主机解绑模板并删除所有模板化实体

请求:

{
           "jsonrpc": "2.0",
           "method": "host.massremove",
           "params": {
               "hostids": ["69665", "69666"],
               "templateids_clear": "325"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": {
               "hostids": [
                   "69665",
                   "69666"
               ]
           },
           "id": 1
       }

监控项原型

来源

CHost::massRemove() 方法位于 ui/include/classes/api/services/CHost.php 文件中。