Zabbix Documentation 3.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

zh:manual:api:reference:hostgroup:create

hostgroup.create

Description说明

object hostgroup.create(object/array hostGroups)

This method allows to create new host groups.此方法允许创建新的主机组。

Parameters 参数

(object/array) Host groups to create. The method accepts host groups with the standard host group properties.主机组创建。 该方法接受具有标准主机组属性的主机组

Return values 返回值

(object) Returns an object containing the IDs of the created host groups under the groupids property. The order of the returned IDs matches the order of the passed host groups.返回包含“groupids”属性下创建的主机组的ID的对象。返回的ID的顺序与传递的主机组的顺序相匹配。

Examples示例

Creating a host group创建主机组

Create a host group called “Linux servers”.建名为“Linux服务器”的主机组。

Request:

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

Response:

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

Source来源

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