Skip to main content

downtimes

Creates, updates, deletes, gets or lists a downtimes resource.

Overview

Namedowntimes
TypeResource
Iddatadog.service_management.downtimes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe downtime ID. (example: 00000000-0000-1234-0000-000000000000)
attributesobjectDowntime details.
relationshipsobjectAll relationships associated with downtime.
typestringDowntime resource type. (default: downtime, example: downtime)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_downtimeselectdowntime_id, regionincludeGet downtime detail by downtime_id.
list_downtimesselectregioncurrent_only, include, page[offset], page[limit]Get all scheduled downtimes.
create_downtimeinsertregion, data__dataSchedule a downtime.
update_downtimeupdatedowntime_id, region, data__dataUpdate a downtime by downtime_id.
cancel_downtimedeletedowntime_id, regionCancel a downtime.

Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
downtime_idstringID of the downtime to cancel.
regionstring(default: datadoghq.com)
current_onlybooleanOnly return downtimes that are active when the request is made.
includestringComma-separated list of resource paths for related resources to include in the response. Supported resource paths are created_by and monitor.
page[limit]integer (int64)Maximum number of downtimes in the response. (example: 100)
page[offset]integer (int64)Specific offset to use as the beginning of the returned page.

SELECT examples

Get downtime detail by downtime_id.

SELECT
id,
attributes,
relationships,
type
FROM datadog.service_management.downtimes
WHERE downtime_id = '{{ downtime_id }}' -- required
AND region = '{{ region }}' -- required
AND include = '{{ include }}'
;

INSERT examples

Schedule a downtime.

INSERT INTO datadog.service_management.downtimes (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data,
included
;

UPDATE examples

Update a downtime by downtime_id.

UPDATE datadog.service_management.downtimes
SET
data__data = '{{ data }}'
WHERE
downtime_id = '{{ downtime_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data,
included;

DELETE examples

Cancel a downtime.

Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.

DELETE FROM datadog.service_management.downtimes
WHERE downtime_id = '{{ downtime_id }}' --required
AND region = '{{ region }}' --required
;