< Back

New-ZabbixMaintenance

Sun Jan 19, 2020 6:12 pm

NAME New-ZabbixMaintenance



SYNOPSIS

Create new maintenance





SYNTAX

New-ZabbixMaintenance [-MaintenanceName] <String> [[-GroupID] <Array>] [[-HostID] <Array>]

[[-MaintenanceDescription] <String>] [[-MaintenanceType] <Int32>] [-ActiveSince] <Object> [-ActiveTill] <Object>

[[-TimePeriodType] <Int32>] [[-TimeperiodStartTime] <Int32>] [[-TimeperiodStartDate] <Object>]

[[-TimeperiodPeriod] <Int32>] [[-TimeperiodEvery] <Int32>] [[-TimeperiodDay] <Int32>] [[-TimeperiodDayOfWeek]

<Int32>] [[-TimeperiodMonth] <Int32>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL]

<String>] [<CommonParameters>]





DESCRIPTION

Create new maintenance





PARAMETERS

-MaintenanceName <String>

Maintenance name (case sensitive)



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-GroupID <Array>



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HostID <Array>



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MaintenanceDescription <String>

Maintenance Description



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MaintenanceType <Int32>

Maintenance maintenance type (0 - (default) with data collection; 1 - without data collection)



Required? false

Position? 5

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-ActiveSince <Object>

Maintenance start time (epoch time format)



Required? true

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ActiveTill <Object>

Maintenance end time (epoch time format)



Required? true

Position? 7

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TimePeriodType <Int32>

Maintenance TimeperiodType (0 - (default) one time only; 2 - daily; 3 - weekly; 4 - monthly)



Required? false

Position? 8

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodStartTime <Int32>

Time of day when the maintenance starts in seconds. Required for daily, weekly and monthly periods. (epoch

time)



Required? false

Position? 9

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodStartDate <Object>

Maintenance timeperiod's start date. Required only for one time periods. Default: current date (epoch time

format)



Required? false

Position? 10

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodPeriod <Int32>

Maintenance timeperiod's period/duration (seconds)



Required? false

Position? 11

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodEvery <Int32>

For daily and weekly periods every defines day or week intervals at which the maintenance must come into

effect.

For monthly periods every defines the week of the month when the maintenance must come into effect.

Possible values: 1 - first week; 2 - second week; 3 - third week; 4 - fourth week; 5 - last week.



Required? false

Position? 12

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodDay <Int32>

Day of the month when the maintenance must come into effect

Required only for monthly time periods



Required? false

Position? 13

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodDayOfWeek <Int32>

Days of the week when the maintenance must come into effect

Days are stored in binary form with each bit representing the corresponding day. For example, 4 equals 100 in

binary and means, that maintenance will be enabled on Wednesday

Used for weekly and monthly time periods. Required only for weekly time periods



Required? false

Position? 14

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-TimeperiodMonth <Int32>

Months when the maintenance must come into effect

Months are stored in binary form with each bit representing the corresponding month. For example, 5 equals 101

in binary and means, that maintenance will be enabled in January and March

Required only for monthly time periods



Required? false

Position? 15

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 16

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? 17

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? 18

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? 19

Default value ($global:zabSessionParams.url)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-ZabbixMaintenance -HostID (Get-ZabbixHost | ? name -match "hosts").hostid -MaintenanceName

"NewMaintenance" -ActiveSince (convertTo-epoch ((get-date).addhours(0)).ToUniversalTime()) -ActiveTill

(convertTo-epoch ((get-date).addhours(7)).ToUniversalTime()) -TimeperiodPeriod (4*3600)



Create new maintenance for few hosts (time will be according Zabbix server time). Maintenance will be active for 7

hours from now, with Period 4 hours, which will start immediately









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>New-ZabbixMaintenance -HostID "10109","10110","10111","10112","10113","10114" -MaintenanceName

NewMaintenanceName -MaintenanceDescription NewMaintenanceDescription -ActiveSince 1432584300 -ActiveTill

1432605900 -TimeperiodStartTime 1432584300 -TimeperiodPeriod 25200



Create new maintenance (time (epoch format) will be according your PC (client) local time). Name and Description

are case sensitive









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>New-ZabbixMaintenance -HostID (Get-ZabbixHost | ? name -match otherhost).hostid -MaintenanceName

NewMaintenanceName -MaintenanceDescription NewMaintenanceDescription -ActiveSince (convertTo-epoch (get-date -date

"05/25/2015 07:05")) -ActiveTill (convertTo-epoch (get-date -date "05/25/2015 17:05")) -TimeperiodPeriod (7*3600)

-TimeperiodStartDate (convertTo-epoch (get-date -date "05/25/2015 09:05"))



Create new, future maintenance (case sensitive) (time will be sent in UTC). Will be set on Zabbix server according

it's local time.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>$hosts=Get-Zabbixhost | ? name -match "host|anotherhost"



$groups=(Get-ZabbixGroup | ? name -match "group")

New-ZabbixMaintenance -HostID $hosts.hostid -GroupID $groups.groupid -MaintenanceName "NewMaintenanceName"

-ActiveSince (convertTo-epoch (convertTo-epoch ((get-date).addhours(0)).ToUniversalTime()) -ActiveTill

(convertTo-epoch ((get-date).addhours(+4)).ToUniversalTime()) -TimeperiodPeriod (3*3600)

Create new maintenance for few hosts (time will be according current Zabbix server time). Maintenance Active from

now for 4 hours, and Period with duration of 3 hours, starting immediately











RELATED LINKS