This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

hostgroup.create

Description

object hostgroup.create(object/array hostGroups)

This method allows to create new host groups.

This method is only available to Super admin user type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

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.

Examples

Creating a host group

Create a host group called "Linux servers".

Request:

{
           "jsonrpc": "2.0",
           "method": "hostgroup.create",
           "params": {
               "name": "Linux servers"
           },
           "id": 1
       }
Copy
✔ Copied

Response:

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

Source

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

To toggle search highlight, press Ctrl+Alt+H
Have an improvement suggestion for this page? Select the text that could be improved and press Ctrl+Enter to send it to the editors.