Sidebar

zh:manual:api:reference:maintenance:update

maintenance.update

Description 说明

object maintenance.update(object/array maintenances)

This method allows to update existing maintenances.该方法允许更新现有维护。

Parameters 参数

(object/array) Maintenance properties to be updated.要更新的维护属性。

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

At this time, partial maintenance update is not supported, all parameters are mandatory. See ZBX-6167 for current status.此时,不支持部分维护更新,所有参数都是必需的。 有关当前状态,请参阅ZBX-6167。

Additionally to the standard maintenance properties, the method accepts the following parameters.除了标准维护属性外,该方法接受以下参数。

属性 类型 说明
groupids array IDs of the host groups to replace the current groups.
hostids array IDs of the hosts to replace the current hosts.
timeperiods array Maintenance time periods to replace the current periods.
At least one host or host group must be defined for each maintenance.

Return values 返回值

(object) Returns an object containing the IDs of the updated maintenances under the maintenanceids property.

Examples 示例

Assigning different hosts

Replace the hosts currently assigned to maintenance “3” with two different ones.

Request:

{
    "jsonrpc": "2.0",
    "method": "maintenance.update",
    "params": {
        "maintenanceid": "3",
        "hostids": [
            "10085",
            "10084"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "maintenanceids": [
            "3"
        ]
    },
    "id": 1
}

See also 参见

Source 来源

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