This is a translation of the original English documentation page. Help us make it better.

maintenance.create

Description

object maintenance.create(object/array maintenances)

This method allows to create new 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) Maintenances to create.

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

Parameter Type Description
groups object/array Host groups that will undergo maintenance.

The host groups must have the groupid property defined.

At least one object of groups or hosts must be specified.
hosts object/array Hosts that will undergo maintenance.

The hosts must have the hostid property defined.

At least one object of groups or hosts must be specified.
timeperiods
(required)
object/array Maintenance time periods.
tags object/array Problem tags.

Define what problems must be suppressed.
If no tags are given, all active maintenance host problems will be suppressed.

Return values

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

Приклади

Creating a maintenance

Create a maintenance with data collection for host group with ID "2" and with problem tags service:mysqld and error. It must be active from 22.01.2013 till 22.01.2014, come in effect each Sunday at 18:00 and last for one hour.

Request:

{
           "jsonrpc": "2.0",
           "method": "maintenance.create",
           "params": {
               "name": "Sunday maintenance",
               "active_since": 1358844540,
               "active_till": 1390466940,
               "tags_evaltype": 0,
               "groups": [
                   {"groupid": "2"}
               ],
               "timeperiods": [
                   {
                       "period": 3600,
                       "timeperiod_type": 3,
                       "start_time": 64800,
                       "every": 1,
                       "dayofweek": 64
                   }
               ],
               "tags": [
                   {
                       "tag": "service",
                       "operator": "0",
                       "value": "mysqld"
                   },
                   {
                       "tag": "error",
                       "operator": "2",
                       "value": ""
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

See also

Джерело

CMaintenance::create() в ui/include/classes/api/services/CMaintenance.php.