downtimes
Creates, updates, deletes, gets or lists a downtimes resource.
Overview
| Name | downtimes |
| Type | Resource |
| Id | datadog.service_management.downtimes |
Fields
The following fields are returned by SELECT queries:
- get_downtime
- list_downtimes
| Name | Datatype | Description |
|---|---|---|
id | string | The downtime ID. (example: 00000000-0000-1234-0000-000000000000) |
attributes | object | Downtime details. |
relationships | object | All relationships associated with downtime. |
type | string | Downtime resource type. (downtime) (default: downtime, example: downtime) |
| Name | Datatype | Description |
|---|---|---|
id | string | The downtime ID. (example: 00000000-0000-1234-0000-000000000000) |
attributes | object | Downtime details. |
relationships | object | All relationships associated with downtime. |
type | string | Downtime resource type. (downtime) (default: downtime, example: downtime) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_downtime | select | downtime_id | include | Get downtime detail by downtime_id. |
list_downtimes | select | current_only, include, page[offset], page[limit] | Get all scheduled downtimes. | |
create_downtime | insert | data | Schedule a downtime. | |
update_downtime | update | downtime_id, data | Update a downtime by downtime_id. | |
cancel_downtime | delete | downtime_id | Cancel a downtime.<br /><br />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.
| Name | Datatype | Description |
|---|---|---|
downtime_id | string | ID of the downtime to cancel. |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
current_only | boolean | Only return downtimes that are active when the request is made. |
include | string | Comma-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
- list_downtimes
Get downtime detail by downtime_id.
SELECT
id,
attributes,
relationships,
type
FROM datadog.service_management.downtimes
WHERE downtime_id = '{{ downtime_id }}' -- required
AND include = '{{ include }}'
;
Get all scheduled downtimes.
SELECT
id,
attributes,
relationships,
type
FROM datadog.service_management.downtimes
WHERE current_only = '{{ current_only }}'
AND include = '{{ include }}'
AND page[offset] = '{{ page[offset] }}'
AND page[limit] = '{{ page[limit] }}'
;
INSERT examples
- create_downtime
- Manifest
Schedule a downtime.
INSERT INTO datadog.service_management.downtimes (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data,
included
;
# Description fields are for documentation purposes
- name: downtimes
props:
- name: data
description: |
Object to create a downtime.
value:
attributes:
display_timezone: "{{ display_timezone }}"
message: "{{ message }}"
monitor_identifier:
monitor_id: {{ monitor_id }}
monitor_tags:
- "{{ monitor_tags }}"
mute_first_recovery_notification: {{ mute_first_recovery_notification }}
notify_end_states:
- "{{ notify_end_states }}"
notify_end_types:
- "{{ notify_end_types }}"
schedule:
recurrences:
- duration: "{{ duration }}"
rrule: "{{ rrule }}"
start: "{{ start }}"
timezone: "{{ timezone }}"
end: "{{ end }}"
start: "{{ start }}"
scope: "{{ scope }}"
type: "{{ type }}"
UPDATE examples
- update_downtime
Update a downtime by downtime_id.
UPDATE datadog.service_management.downtimes
SET
data = '{{ data }}'
WHERE
downtime_id = '{{ downtime_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;
DELETE examples
- cancel_downtime
Cancel a downtime.<br /><br />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
;