Downtime

Register Downtime

This section covers register downtime in Mackerel.

POST /api/v0/downtimes

Required permissions for the API key

  • Read
  • Write

Input

Objects that hold the following keys:

KEY TYPE DESCRIPTION
name string the name of the downtime
memo string [optional] notes for the downtime
start number the starting time(in epoch seconds)
duration number the duration of downtime (in minutes)
recurrence recurrence [optional] configuration for repeating occurrences
serviceScopes array[string] [optional] scope of target services. service name array*
serviceExcludeScopes array[string] [optional] scope of excluded services. service name array*
roleScopes array[string] [optional] scope of target roles. role fullname array*
roleExcludeScopes array[string] [optional] scope of excluded roles. role fullname array*
monitorScopes array[string] [optional] scope of target monitor configurations. <monitor id> array
monitorExcludeScopes array[string] [optional] scope of excluded monitor configurations. <monitor id> array

<recurrence> is an object that hold the following keys:

KEY TYPE DESCRIPTION
type string recurrence options (hourly, daily, weekly, monthly, yearly)
interval number recurrence interval
weekdays array[string] [optional] configuration for the day of the week (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). Only available when the type is set to weekly
until number [optional] the time at which recurrence ends (in epoch seconds)

Response

Success

The input is returned along with an ID.

Error

STATUS CODE DESCRIPTION
400 when the input is invalid
400 when the name or memo is too long
400 when the downtime duration is invalid
400 when the recurrence configuration is invalid
400 when the target service/role/monitor setting of the scope is redundant or does not exist
400 when the service/role/monitor setting of the scope does not exist
403 when the API key doesn't have the required permissions / when accessing from outside the permitted IP address range

* Service name and Role service name

Service name as well as role service name are character strings in the format <service name> and <service name>:<role name>.

e.g. If the service name for Hatena-Bookmark is Hatena-Bookmark then the db-master role in the service Hatena-Bookmark would be Hatena-Bookmark:db-master

Usable characters are /^[A-Za-z0-9][A-Za-z0-9_-]+$/.


List Downtime

GET /api/v0/downtimes

Required permissions for the API key

  • Read

Response

KEY TYPE DESCRIPTION
downtimes array[object] a list of the downtime

Update Downtime

PUT /api/v0/downtimes/<downtimeId>

Required permissions for the API key

  • Read
  • Write

Input

Same as Register Downtime.

Response

Success

The updated downtime is returned. Same format as Register Downtime.

Error

STATUS CODE DESCRIPTION
400 when the input is invalid
400 when the name or memo is too long
400 when the downtime duration is invalid
400 when the recurrence configuration is invalid
400 when the target service/role/monitor setting of the scope is redundant or does not exist
400 when the service/role/monitor setting of the scope does not exist
403 when the API key doesn't have the required permissions / when accessing from outside the permitted IP address range
404 when the downtime corresponding to the designated ID can't be found

Delete Downtime

This will delete the downtime corresponding to the designated ID.

DELETE /api/v0/downtimes/<downtimeId>

Required permissions for the API key

  • Read
  • Write

Response

Success

The downtime before deletion is returned, same as Register Downtime.

Error

STATUS CODE DESCRIPTION
403 when the API key doesn't have the required permissions / when accessing from outside the permitted IP address range
404 when the downtime corresponding to the designated ID can't be found