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



object service.update(object/array services)

This method allows to update existing services此方法允许更新现有服务.


(object/array) service properties to be updated服务属性要更新.

The serviceid property must be defined for each service, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 必须为每个服务定义serviceid属性,所有其他属性都是可选的。只有通过的属性将被更新,所有其他属性将保持不变。

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

Parameter参数 T pe类型 Des ription说明
dependencies array Service dependencies to replace the current 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 replace the current service times服务时间来替换当前的服务时间.

Return values返回值

(object) Returns an object containing the IDs of the updated services under the serviceids property. (object)返回一个包含serviceids属性下更新服务的ID的对象。


Setting the parent of an service设置父级服务

Make service "3" the hard-linked parent of service "5".使服务"3"链接于父级服务"5".


           "jsonrpc": "2.0",
           "method": "service.update",
           "params": {
               "serviceid": "5",
               "parentid": "3"
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1


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

See also参考


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