maintenance.update

Description

object maintenance.update(object/array maintenances)

This method allows to update existing maintenances.

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

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.

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

ParameterTypeDescription
groupsobject/arrayHost groups to replace the current groups.

The host groups must have the groupid property defined.

Parameter behavior:
- required if hosts is not set
hostsobject/arrayHosts to replace the current hosts.

The hosts must have only the hostid property defined.

Parameter behavior:
- required if groups is not set
timeperiodsobject/arrayMaintenance time periods to replace the current periods.
tagsobject/arrayProblem tags to replace the current tags.

Parameter behavior:
- supported if maintenance_type of Maintenance object is set to “with data collection”
groupids
(deprecated)
arrayThis parameter is deprecated, please use groups instead.
IDs of the host groups that will undergo maintenance.
hostids
(deprecated)
arrayThis parameter is deprecated, please use hosts instead.
IDs of the hosts that will undergo 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 with two different ones.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "maintenance.update",
  4. "params": {
  5. "maintenanceid": "3",
  6. "hosts": [
  7. {"hostid": "10085"},
  8. {"hostid": "10084"}
  9. ]
  10. },
  11. "id": 1
  12. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "maintenanceids": [
  5. "3"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

Source

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