Zabbix Documentation 3.0

3.04.05.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.24.4Guidelines

User Tools

Site Tools


manual:api:reference:maintenance:create

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:api:reference:maintenance:create [2015/11/19 14:33]
sasha [Source] fixed path
manual:api:reference:maintenance:create [2019/01/28 14:49]
sasha <code js> => <code java>
Line 1: Line 1:
-===== maintenance.create ===== 
  
-==== Description ==== 
- 
-''​object maintenance.create(object/​array **maintenances**)''​ 
- 
-This method allows to create new maintenances. 
- 
-==== Parameters ==== 
- 
-''​(object/​array)''​ Maintenances to create. 
- 
-Additionally to the [[object#​maintenance|standard maintenance properties]],​ the method accepts the following parameters. 
- 
-^ Parameter ^ Type ^ Description ^ 
-| **groupids** \\ (required) | array | IDs of the host groups that will undergo maintenance. | 
-| **hostids** \\ (required) | array | IDs of the hosts that will undergo maintenance. | 
-| **timeperiods** \\ (required) | array | Maintenance time periods. | 
- 
-<note important>​At least one host or host group must be defined for each maintenance.</​note>​ 
- 
-==== 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. 
- 
-==== Examples ==== 
- 
-=== Creating a maintenance === 
- 
-Create a maintenance with data collection for host group "​2"​. 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: 
-<code js> 
-{ 
-    "​jsonrpc":​ "​2.0",​ 
-    "​method":​ "​maintenance.create",​ 
-    "​params":​ { 
-        "​name":​ "​Sunday maintenance",​ 
-        "​active_since":​ 1358844540, 
-        "​active_till":​ 1390466940, 
-        "​groupids":​ [ 
-            "​2"​ 
-        ], 
-        "​timeperiods":​ [ 
-            { 
-                "​timeperiod_type":​ 3, 
-                "​every":​ 1, 
-                "​dayofweek":​ 64, 
-                "​start_time":​ 64800, 
-                "​period":​ 3600 
-            } 
-        ] 
-    }, 
-    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​ 
-    "​id":​ 1 
-} 
-</​code>​ 
- 
-Response: 
-<code js> 
-{ 
-    "​jsonrpc":​ "​2.0",​ 
-    "​result":​ { 
-        "​maintenanceids":​ [ 
-            "​3"​ 
-        ] 
-    }, 
-    "​id":​ 1 
-} 
-</​code>​ 
- 
-==== See also ==== 
- 
-  * [[object#​time_period|Time period]] 
- 
-==== Source ==== 
- 
-CMaintenance::​create() in //​frontends/​php/​include/​classes/​api/​services/​CMaintenance.php//​.