Zabbix Documentation 4.0

3.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.22.43.23.4

User Tools

Site Tools


Sidebar

zh:manual:api:reference:hostgroup:create

创建

描述

object hostgroup.create(object/array hostGroups)

此方法允许创建新的主机组.

参数

(object/array) 创建主机组.该方法接受具有标准主机组属性的主机组.

返回值

(object)groupids属性下返回包含已创建主机组ID的对象.返回主机组ID的顺序与传入的主机组顺序一致.

示例

创建主机组

创建名为“Linux servers”的主机组.

请求:

{
    "jsonrpc": "2.0",
    "method": "hostgroup.create",
    "params": {
        "name": "Linux servers"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

响应:

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

来源

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