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.

service.create

Description

object service.create(object/array services)

This method allows to create new services.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) services to create.

Additionally to the standard service properties, the method accepts the following parameters.

Parameter Type Description
children array Child services to be linked to the service.

The children must have the serviceid property defined.
parents array Parent services to be linked to the service.

The parents must have the serviceid property defined.
tags array Service tags to be created for the service.
problem_tags array Problem tags to be created for the service.
status_rules array Status rules to be created for the service.

Return values

(object) Returns an object containing the IDs of the created services under the serviceids property. The order of the returned IDs matches the order of the passed services.

Examples

Creating a service

Create a service that will be switched to problem state, if at least one child has a problem.

Request:

{
           "jsonrpc": "2.0",
           "method": "service.create",
           "params": {
               "name": "Server 1",
               "algorithm": 1,
               "sortorder": 1
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

Source

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