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

hostgroup.delete

Description 说明

object hostgroup.delete(array hostGroupIds)

This method allows to delete host groups.此方法允许删除主机组。

A host group can not be deleted if:如果主机组有以下情况,则不能被删除:

  • it contains hosts that belong to this group only;它只包含属于此组的主机;
  • it is marked as internal;被标记为内部;
  • it is used by a host prototype;被主机原型使用;
  • it is used in a global script;在全局脚本中使用;
  • it is used in a correlation condition.在相关条件下使用。

Parameters参数

(array) IDs of the host groups to delete.要删除的主机组的ID。

Return values 返回值

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

Examples 示例

Deleting multiple host groups删除多个主机组

Delete two host groups.删除两个主机组

Request:

{
           "jsonrpc": "2.0",
           "method": "hostgroup.delete",
           "params": [
               "107824",
               "107825"
           ],
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "groupids": [
                   "107824",
                   "107825"
               ]
           },
           "id": 1
       }

Source来源

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