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



object service.create(object/array services)

This method allows to create new services这种方法允许创建新的服务.


(object/array) services to create服务创建.

Additionally to the standard service properties, the method accepts the following parameters. 除standard service properties之外,该方法接受以下参数。

Parameter参数 T pe类型 Des ription说明
dependencies array Service dependencies服务依赖.

Each service dependency has the following parameters每个服务依赖项具有以下参数:
- dependsOnServiceid - (string) ID of an service the service depends on, that is, the child service服务所依赖的服务的ID,即子服务.
- soft - (integer) type of service dependency服务依赖类型; refer to the service dependency object page for more information on dependency types. 有关依赖关系类型的更多信息,请参阅service dependency object page
parentid string ID of a hard-linked parent service硬链接的父服务的ID.
times array Service times 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. (object)返回一个包含serviceids属性下创建的服务ID的对象,返回的ID的顺序与传递的服务的顺序相匹配。


Creating an service创建服务

Create an service that will be switched to problem state, if at least one child has a problem. SLA calculation will be on and the minimum acceptable SLA is 99.99%.创建一个将被切换到问题状态的服务,如果至少子级有问题。SLA计算将打开,最小可接受SLA为99.99%。


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


           "jsonrpc": "2.0",
           "result": {
               "serviceids": [
           "id": 1


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