Sidebar

zh:manual:api:reference:hostgroup:massremove

hostgroup.massremove

Description 说明

object hostgroup.massremove(object parameters)

This method allows to remove related objects from multiple host groups.此方法允许从多个主机组中删除相关对象。

Parameters 参数

(object) Parameters containing the IDs of the host groups to update and the objects that should be removed.含要更新的主机组的ID和应该删除的对象的参数。

参数 类型 描述
groupids
(required)
string/array IDs of the host groups to be updated.要更新的主机组的ID。
hostids string/array Hosts to remove from all host groups.要从所有主机组中删除的主机。
templateids string/array Templates to remove from all host groups.要从所有主机组中删除的模板。

Return values 返回值

(object) Returns an object containing the IDs of the updated host groups under the groupids property.返回包含“groupids”属性下更新的主机组的ID的对象。

Examples示例

Removing hosts from host groups从主机组中删除主机

Remove two hosts from the given host groups.从给定的主机组中删除两个主机。

Request:

{
    "jsonrpc": "2.0",
    "method": "hostgroup.massremove",
    "params": {
        "groupids": [
            "5",
            "6"
        ],
        "hostids": [
            "30050",
            "30001"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "groupids": [
            "5",
            "6"
        ]
    },
    "id": 1
}

Source 来源

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