Class containing methods for operations with Maintenances.

get() Get maintenance details
exists() Check if maintenance exists
create() Create maintenances
update() Update maintenance details
delete() Delete maintenances

Object details

The table contains complete list of Maintenance attributes.


maintenanceidintegerMaintenance ID
maintenance_typeintegerType. 0: With data collection
1: No data collection
active_sinceintegerActivation date. Unix timestamp
active_tillintegerDeactivation date. Unix timestamp
timeperiodsarray of timeperiod objectsTimeperiods


timeperiod_typeintegerType defines what fields are used and how values of those fields are processed.
Required fields by timeperiod type:
0 - start_date, period;
2 - start_time, period, every;
3 - start_time, period, every, dayofweek;
4 - start_time, period, every, dayofweek, month, day;
0: Onetime
2: Daily
3: Weekly
4: Monthly
everyintegerDepends on type:
2 - every Nth day (if every=2 timeperiod is triggered every second day);
3 - every Nth week
4 - is used when field day is 0 and then means every Nth week of month (1 - 5)
monthintegerNumber, got by converting binary number, where each bit represents one month (Dec is first bit, Jan is last bit) to decimal number.
For example if you need maintenance on March and April, binary representation is '000000001100' and decimal is 12.
dayofweekintegerUsed for type 3 and for type 4 when day is 0.
Number with week days calculated in same way as month. (Sun is first bit, Mon is last bit)
dayintegerIf equal to 0 then field every and dayofweek are used, otherwise represents number of day on which timeperiod is triggered.
start_timeintegerPeriod start time in seconds
periodintegerPeriod length in seconds
start_dateintegerPeriod start date as Unix timestamp

Common tasks

The table contains list of common maintenance-related tasks and possible implementation using Zabbix API

Add a maintenance Use method maintenance.create
Add a bunch of new maintenances Use method maintenance.create with array of Maintenance objects
Rename a maintenance Use method maintenance.update, set “name”:“<new name>“
Retrieve maintenance details by Maintenance IDs Use method maintenance.get with parameter maintenanceids
Retrieve maintenance details by Maintenance name Use method maintenance.get with parameter filter, specify “name”:”<your maintenance>“