Les downtimes vous permettent de mieux contrôler les notifications d’un contrôleur en empêchant certains contextes de déclencher des alertes. Les paramètres de downtime, qui peuvent être planifiés avec une heure de début et de fin, désactivent toutes les notifications liées à des tags Datadog.
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
{"active":true,"active_child":{"active":true,"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1626,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456},"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1625,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456}
"""
Get all downtimes returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.list_downtimes(with_creator=True,)print(response)
# Get all downtimes returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.newopts={with_creator:true,}papi_instance.list_downtimes(opts)
require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Get all downtimesdog.get_all_downtimes
// Get all downtimes returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::api_downtimes::ListDowntimesOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.list_downtimes(ListDowntimesOptionalParams::default().with_creator(true)).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
// Get all downtimes returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.ListDowntimes(ctx,*datadogV1.NewListDowntimesOptionalParameters().WithWithCreator(true))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.ListDowntimes`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.ListDowntimes`:\n%s\n",responseContent)}
// Get all downtimes returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.api.DowntimesApi.ListDowntimesOptionalParameters;importcom.datadog.api.client.v1.model.Downtime;importjava.util.List;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);try{List<Downtime>result=apiInstance.listDowntimes(newListDowntimesOptionalParameters().withCreator(true));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#listDowntimes");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apioptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Get all downtimesprint(api.Downtime.get_all())
/**
* Get all downtimes returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);constparams: v1.DowntimesApiListDowntimesRequest={withCreator: true,};apiInstance.listDowntimes(params).then((data: v1.Downtime[])=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
modified
date-time
Time that the downtime was last modified.
monitor_identifier
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules:
one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are
provided, the downtime will begin immediately and never end.
Option 1
object
A recurring downtime schedule definition.
current_downtime
object
The most recent actual start and end dates for a recurring downtime. For a canceled downtime,
this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled
downtimes it is the upcoming downtime.
end
date-time
The end of the current downtime.
start
date-time
The start of the current downtime.
recurrences [required]
[object]
A list of downtime recurrences.
duration
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime. This affects recurring start and end dates.
Must match display_timezone.
{"data":[{"attributes":{"canceled":"2020-01-02T03:04:05.282979+0000","created":"2020-01-02T03:04:05.282979+0000","display_timezone":"America/New_York","message":"Message about the downtime","modified":"2020-01-02T03:04:05.282979+0000","monitor_identifier":{"monitor_id":123},"mute_first_recovery_notification":false,"notify_end_states":["alert","warn"],"notify_end_types":["canceled","expired"],"schedule":{"current_downtime":{"end":"2020-01-02T03:04:00.000Z","start":"2020-01-02T03:04:00.000Z"},"recurrences":[{"duration":"123d","rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","start":"2020-01-02T03:04"}],"timezone":"America/New_York"},"scope":"env:(staging OR prod) AND datacenter:us-east-1","status":"active"},"id":"00000000-0000-1234-0000-000000000000","relationships":{"created_by":{"data":{"id":"00000000-0000-1234-0000-000000000000","type":"users"}},"monitor":{"data":{"id":"12345","type":"monitors"}}},"type":"downtime"}],"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","mfa_enabled":false,"modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}],"meta":{"page":{"total_filtered_count":"integer"}}}
"""
Get all downtimes returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.downtimes_apiimportDowntimesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.list_downtimes()print(response)
// Get all downtimes returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDowntimesApi(apiClient)resp,r,err:=api.ListDowntimes(ctx,*datadogV2.NewListDowntimesOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.ListDowntimes`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.ListDowntimes`:\n%s\n",responseContent)}
// Get all downtimes returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DowntimesApi;importcom.datadog.api.client.v2.model.ListDowntimesResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);try{ListDowntimesResponseresult=apiInstance.listDowntimes();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#listDowntimes");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get all downtimes returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV2::api_downtimes::ListDowntimesOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.list_downtimes(ListDowntimesOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get all downtimes returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);apiInstance.listDowntimes().then((data: v2.ListDowntimesResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
active
boolean
If a scheduled downtime currently exists.
active_child
object
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
{"active":true,"active_child":{"active":true,"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1626,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456},"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1625,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456}
// Schedule a downtime once a year
packagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.Downtime{Message:*datadog.NewNullableString(datadog.PtrString("Example-Downtime")),Recurrence:*datadogV1.NewNullableDowntimeRecurrence(&datadogV1.DowntimeRecurrence{Period:datadog.PtrInt32(1),Type:datadog.PtrString("years"),}),Scope:[]string{"*",},Start:datadog.PtrInt64(time.Now().Unix()),End:*datadog.NewNullableInt64(datadog.PtrInt64(time.Now().Add(time.Hour*1).Unix())),Timezone:datadog.PtrString("Etc/UTC"),MuteFirstRecoveryNotification:datadog.PtrBool(true),MonitorTags:[]string{"tag0",},NotifyEndStates:[]datadogV1.NotifyEndState{datadogV1.NOTIFYENDSTATE_ALERT,datadogV1.NOTIFYENDSTATE_WARN,},NotifyEndTypes:[]datadogV1.NotifyEndType{datadogV1.NOTIFYENDTYPE_EXPIRED,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.CreateDowntime(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CreateDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.CreateDowntime`:\n%s\n",responseContent)}
// Schedule a downtime returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.Downtime{Message:*datadog.NewNullableString(datadog.PtrString("Example-Downtime")),Start:datadog.PtrInt64(time.Now().Unix()),End:*datadog.NewNullableInt64(datadog.PtrInt64(time.Now().Add(time.Hour*1).Unix())),Timezone:datadog.PtrString("Etc/UTC"),Scope:[]string{"test:exampledowntime",},Recurrence:*datadogV1.NewNullableDowntimeRecurrence(&datadogV1.DowntimeRecurrence{Type:datadog.PtrString("weeks"),Period:datadog.PtrInt32(1),WeekDays:*datadog.NewNullableList(&[]string{"Mon","Tue","Wed","Thu","Fri",}),UntilDate:*datadog.NewNullableInt64(datadog.PtrInt64(time.Now().AddDate(0,0,21).Unix())),}),NotifyEndStates:[]datadogV1.NotifyEndState{datadogV1.NOTIFYENDSTATE_ALERT,datadogV1.NOTIFYENDSTATE_NO_DATA,datadogV1.NOTIFYENDSTATE_WARN,},NotifyEndTypes:[]datadogV1.NotifyEndType{datadogV1.NOTIFYENDTYPE_CANCELED,datadogV1.NOTIFYENDTYPE_EXPIRED,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.CreateDowntime(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CreateDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.CreateDowntime`:\n%s\n",responseContent)}
// Schedule a downtime until date
packagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.Downtime{Message:*datadog.NewNullableString(datadog.PtrString("Example-Downtime")),Recurrence:*datadogV1.NewNullableDowntimeRecurrence(&datadogV1.DowntimeRecurrence{Period:datadog.PtrInt32(1),Type:datadog.PtrString("weeks"),UntilDate:*datadog.NewNullableInt64(datadog.PtrInt64(time.Now().AddDate(0,0,21).Unix())),WeekDays:*datadog.NewNullableList(&[]string{"Mon","Tue","Wed","Thu","Fri",}),}),Scope:[]string{"*",},Start:datadog.PtrInt64(time.Now().Unix()),End:*datadog.NewNullableInt64(datadog.PtrInt64(time.Now().Add(time.Hour*1).Unix())),Timezone:datadog.PtrString("Etc/UTC"),MuteFirstRecoveryNotification:datadog.PtrBool(true),MonitorTags:[]string{"tag0",},NotifyEndStates:[]datadogV1.NotifyEndState{datadogV1.NOTIFYENDSTATE_ALERT,},NotifyEndTypes:[]datadogV1.NotifyEndType{datadogV1.NOTIFYENDTYPE_CANCELED,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.CreateDowntime(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CreateDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.CreateDowntime`:\n%s\n",responseContent)}
// Schedule a downtime once a yearimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;importcom.datadog.api.client.v1.model.DowntimeRecurrence;importcom.datadog.api.client.v1.model.NotifyEndState;importcom.datadog.api.client.v1.model.NotifyEndType;importjava.time.OffsetDateTime;importjava.util.Arrays;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);Downtimebody=newDowntime().message("Example-Downtime").recurrence(newDowntimeRecurrence().period(1).type("years")).scope(Collections.singletonList("*")).start(OffsetDateTime.now().toInstant().getEpochSecond()).end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond()).timezone("Etc/UTC").muteFirstRecoveryNotification(true).monitorTags(Collections.singletonList("tag0")).notifyEndStates(Arrays.asList(NotifyEndState.ALERT,NotifyEndState.WARN)).notifyEndTypes(Collections.singletonList(NotifyEndType.EXPIRED));try{Downtimeresult=apiInstance.createDowntime(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#createDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Schedule a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;importcom.datadog.api.client.v1.model.DowntimeRecurrence;importcom.datadog.api.client.v1.model.NotifyEndState;importcom.datadog.api.client.v1.model.NotifyEndType;importjava.time.OffsetDateTime;importjava.util.Arrays;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);Downtimebody=newDowntime().message("Example-Downtime").start(OffsetDateTime.now().toInstant().getEpochSecond()).end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond()).timezone("Etc/UTC").scope(Collections.singletonList("test:exampledowntime")).recurrence(newDowntimeRecurrence().type("weeks").period(1).weekDays(Arrays.asList("Mon","Tue","Wed","Thu","Fri")).untilDate(OffsetDateTime.now().plusDays(21).toInstant().getEpochSecond())).notifyEndStates(Arrays.asList(NotifyEndState.ALERT,NotifyEndState.NO_DATA,NotifyEndState.WARN)).notifyEndTypes(Arrays.asList(NotifyEndType.CANCELED,NotifyEndType.EXPIRED));try{Downtimeresult=apiInstance.createDowntime(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#createDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Schedule a downtime until dateimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;importcom.datadog.api.client.v1.model.DowntimeRecurrence;importcom.datadog.api.client.v1.model.NotifyEndState;importcom.datadog.api.client.v1.model.NotifyEndType;importjava.time.OffsetDateTime;importjava.util.Arrays;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);Downtimebody=newDowntime().message("Example-Downtime").recurrence(newDowntimeRecurrence().period(1).type("weeks").untilDate(OffsetDateTime.now().plusDays(21).toInstant().getEpochSecond()).weekDays(Arrays.asList("Mon","Tue","Wed","Thu","Fri"))).scope(Collections.singletonList("*")).start(OffsetDateTime.now().toInstant().getEpochSecond()).end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond()).timezone("Etc/UTC").muteFirstRecoveryNotification(true).monitorTags(Collections.singletonList("tag0")).notifyEndStates(Collections.singletonList(NotifyEndState.ALERT)).notifyEndTypes(Collections.singletonList(NotifyEndType.CANCELED));try{Downtimeresult=apiInstance.createDowntime(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#createDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apiimporttimeoptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Repeat for 3 hours (starting now) on every week day for 4 weeks.start_ts=int(time.time())end_ts=start_ts+(3*60*60)end_reccurrence_ts=start_ts+(4*7*24*60*60)# 4 weeks from nowrecurrence={'type':'weeks','period':1,'week_days':['Mon','Tue','Wed','Thu','Fri'],'until_date':end_reccurrence_ts}# Schedule downtimeapi.Downtime.create(scope='env:staging',start=start_ts,end=end_ts,recurrence=recurrence)# OR use RRULE reccurencerrule_recurrence={'type':'rrule','rrule':'FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1',}# Schedule downtimeapi.Downtime.create(scope='env:staging',start=start_ts,end=end_ts,recurrence=rrule_recurrence)
"""
Schedule a downtime once a year
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.downtimeimportDowntimefromdatadog_api_client.v1.model.downtime_recurrenceimportDowntimeRecurrencefromdatadog_api_client.v1.model.notify_end_stateimportNotifyEndStatefromdatadog_api_client.v1.model.notify_end_typeimportNotifyEndTypebody=Downtime(message="Example-Downtime",recurrence=DowntimeRecurrence(period=1,type="years",),scope=["*",],start=int(datetime.now().timestamp()),end=int((datetime.now()+relativedelta(hours=1)).timestamp()),timezone="Etc/UTC",mute_first_recovery_notification=True,monitor_tags=["tag0",],notify_end_states=[NotifyEndState.ALERT,NotifyEndState.WARN,],notify_end_types=[NotifyEndType.EXPIRED,],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.create_downtime(body=body)print(response)
"""
Schedule a downtime returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.downtimeimportDowntimefromdatadog_api_client.v1.model.downtime_recurrenceimportDowntimeRecurrencefromdatadog_api_client.v1.model.notify_end_stateimportNotifyEndStatefromdatadog_api_client.v1.model.notify_end_typeimportNotifyEndTypebody=Downtime(message="Example-Downtime",start=int(datetime.now().timestamp()),end=int((datetime.now()+relativedelta(hours=1)).timestamp()),timezone="Etc/UTC",scope=["test:exampledowntime",],recurrence=DowntimeRecurrence(type="weeks",period=1,week_days=["Mon","Tue","Wed","Thu","Fri",],until_date=int((datetime.now()+relativedelta(days=21)).timestamp()),),notify_end_states=[NotifyEndState.ALERT,NotifyEndState.NO_DATA,NotifyEndState.WARN,],notify_end_types=[NotifyEndType.CANCELED,NotifyEndType.EXPIRED,],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.create_downtime(body=body)print(response)
"""
Schedule a downtime until date
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.downtimeimportDowntimefromdatadog_api_client.v1.model.downtime_recurrenceimportDowntimeRecurrencefromdatadog_api_client.v1.model.notify_end_stateimportNotifyEndStatefromdatadog_api_client.v1.model.notify_end_typeimportNotifyEndTypebody=Downtime(message="Example-Downtime",recurrence=DowntimeRecurrence(period=1,type="weeks",until_date=int((datetime.now()+relativedelta(days=21)).timestamp()),week_days=["Mon","Tue","Wed","Thu","Fri",],),scope=["*",],start=int(datetime.now().timestamp()),end=int((datetime.now()+relativedelta(hours=1)).timestamp()),timezone="Etc/UTC",mute_first_recovery_notification=True,monitor_tags=["tag0",],notify_end_states=[NotifyEndState.ALERT,],notify_end_types=[NotifyEndType.CANCELED,],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.create_downtime(body=body)print(response)
require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Repeat for 3 hours (starting now) on every week day for 4 weeks.start_ts=Time.now.to_iend_ts=start_ts+(3*60*60)end_reccurrence_ts=start_ts+(4*7*24*60*60)# 4 weeks from nowrecurrence={'type'=>'weeks','period'=>1,'week_days'=>%w[Mon Tue Wed Thu Fri],'until_date'=>end_reccurrence_ts}# Schedule downtimedog.Downtime.create('env:staging',start:start_ts,end:end_ts,recurrence:recurrence)# OR use RRULE reccurencerrule_recurrence={'type'=>'rrule','rrule'=>'FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1',}# Schedule downtimedog.Downtime.create('env:staging',start:start_ts,end:end_ts,recurrence:rrule_recurrence)
# Schedule a downtime once a yearrequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.newbody=DatadogAPIClient::V1::Downtime.new({message:"Example-Downtime",recurrence:DatadogAPIClient::V1::DowntimeRecurrence.new({period:1,type:"years",}),scope:["*",],start:Time.now.to_i,_end:(Time.now+1*3600).to_i,timezone:"Etc/UTC",mute_first_recovery_notification:true,monitor_tags:["tag0",],notify_end_states:[DatadogAPIClient::V1::NotifyEndState::ALERT,DatadogAPIClient::V1::NotifyEndState::WARN,],notify_end_types:[DatadogAPIClient::V1::NotifyEndType::EXPIRED,],})papi_instance.create_downtime(body)
# Schedule a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.newbody=DatadogAPIClient::V1::Downtime.new({message:"Example-Downtime",start:Time.now.to_i,_end:(Time.now+1*3600).to_i,timezone:"Etc/UTC",scope:["test:exampledowntime",],recurrence:DatadogAPIClient::V1::DowntimeRecurrence.new({type:"weeks",period:1,week_days:["Mon","Tue","Wed","Thu","Fri",],until_date:(Time.now+21*86400).to_i,}),notify_end_states:[DatadogAPIClient::V1::NotifyEndState::ALERT,DatadogAPIClient::V1::NotifyEndState::NO_DATA,DatadogAPIClient::V1::NotifyEndState::WARN,],notify_end_types:[DatadogAPIClient::V1::NotifyEndType::CANCELED,DatadogAPIClient::V1::NotifyEndType::EXPIRED,],})papi_instance.create_downtime(body)
# Schedule a downtime until daterequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.newbody=DatadogAPIClient::V1::Downtime.new({message:"Example-Downtime",recurrence:DatadogAPIClient::V1::DowntimeRecurrence.new({period:1,type:"weeks",until_date:(Time.now+21*86400).to_i,week_days:["Mon","Tue","Wed","Thu","Fri",],}),scope:["*",],start:Time.now.to_i,_end:(Time.now+1*3600).to_i,timezone:"Etc/UTC",mute_first_recovery_notification:true,monitor_tags:["tag0",],notify_end_states:[DatadogAPIClient::V1::NotifyEndState::ALERT,],notify_end_types:[DatadogAPIClient::V1::NotifyEndType::CANCELED,],})papi_instance.create_downtime(body)
// Schedule a downtime once a year
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::Downtime;usedatadog_api_client::datadogV1::model::DowntimeRecurrence;usedatadog_api_client::datadogV1::model::NotifyEndState;usedatadog_api_client::datadogV1::model::NotifyEndType;#[tokio::main]asyncfnmain(){letbody=Downtime::new().end(Some(1636632671)).message(Some("Example-Downtime".to_string())).monitor_tags(vec!["tag0".to_string()]).mute_first_recovery_notification(true).notify_end_states(vec![NotifyEndState::ALERT,NotifyEndState::WARN]).notify_end_types(vec![NotifyEndType::EXPIRED]).recurrence(Some(DowntimeRecurrence::new().period(1).type_("years".to_string()),)).scope(vec!["*".to_string()]).start(1636629071).timezone("Etc/UTC".to_string());letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.create_downtime(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
// Schedule a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::Downtime;usedatadog_api_client::datadogV1::model::DowntimeRecurrence;usedatadog_api_client::datadogV1::model::NotifyEndState;usedatadog_api_client::datadogV1::model::NotifyEndType;#[tokio::main]asyncfnmain(){letbody=Downtime::new().end(Some(1636632671)).message(Some("Example-Downtime".to_string())).notify_end_states(vec![NotifyEndState::ALERT,NotifyEndState::NO_DATA,NotifyEndState::WARN,]).notify_end_types(vec![NotifyEndType::CANCELED,NotifyEndType::EXPIRED]).recurrence(Some(DowntimeRecurrence::new().period(1).type_("weeks".to_string()).until_date(Some(1638443471)).week_days(Some(vec!["Mon".to_string(),"Tue".to_string(),"Wed".to_string(),"Thu".to_string(),"Fri".to_string(),])),)).scope(vec!["test:exampledowntime".to_string()]).start(1636629071).timezone("Etc/UTC".to_string());letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.create_downtime(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
// Schedule a downtime until date
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::Downtime;usedatadog_api_client::datadogV1::model::DowntimeRecurrence;usedatadog_api_client::datadogV1::model::NotifyEndState;usedatadog_api_client::datadogV1::model::NotifyEndType;#[tokio::main]asyncfnmain(){letbody=Downtime::new().end(Some(1636632671)).message(Some("Example-Downtime".to_string())).monitor_tags(vec!["tag0".to_string()]).mute_first_recovery_notification(true).notify_end_states(vec![NotifyEndState::ALERT]).notify_end_types(vec![NotifyEndType::CANCELED]).recurrence(Some(DowntimeRecurrence::new().period(1).type_("weeks".to_string()).until_date(Some(1638443471)).week_days(Some(vec!["Mon".to_string(),"Tue".to_string(),"Wed".to_string(),"Thu".to_string(),"Fri".to_string(),])),)).scope(vec!["*".to_string()]).start(1636629071).timezone("Etc/UTC".to_string());letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.create_downtime(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Schedule a downtime once a year
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);constparams: v1.DowntimesApiCreateDowntimeRequest={body:{message:"Example-Downtime",recurrence:{period: 1,type:"years",},scope:["*"],start: Math.round(newDate().getTime()/1000),end: Math.round(newDate(newDate().getTime()+1*3600*1000).getTime()/1000),timezone:"Etc/UTC",muteFirstRecoveryNotification: true,monitorTags:["tag0"],notifyEndStates:["alert","warn"],notifyEndTypes:["expired"],},};apiInstance.createDowntime(params).then((data: v1.Downtime)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Schedule a downtime returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);constparams: v1.DowntimesApiCreateDowntimeRequest={body:{message:"Example-Downtime",start: Math.round(newDate().getTime()/1000),end: Math.round(newDate(newDate().getTime()+1*3600*1000).getTime()/1000),timezone:"Etc/UTC",scope:["test:exampledowntime"],recurrence:{type:"weeks",period: 1,weekDays:["Mon","Tue","Wed","Thu","Fri"],untilDate: Math.round(newDate(newDate().getTime()+21*86400*1000).getTime()/1000),},notifyEndStates:["alert","no data","warn"],notifyEndTypes:["canceled","expired"],},};apiInstance.createDowntime(params).then((data: v1.Downtime)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Schedule a downtime until date
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);constparams: v1.DowntimesApiCreateDowntimeRequest={body:{message:"Example-Downtime",recurrence:{period: 1,type:"weeks",untilDate: Math.round(newDate(newDate().getTime()+21*86400*1000).getTime()/1000),weekDays:["Mon","Tue","Wed","Thu","Fri"],},scope:["*"],start: Math.round(newDate().getTime()/1000),end: Math.round(newDate(newDate().getTime()+1*3600*1000).getTime()/1000),timezone:"Etc/UTC",muteFirstRecoveryNotification: true,monitorTags:["tag0"],notifyEndStates:["alert"],notifyEndTypes:["canceled"],},};apiInstance.createDowntime(params).then((data: v1.Downtime)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
monitor_identifier [required]
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
Schedule for the downtime.
Option 1
object
A recurring downtime schedule definition.
recurrences [required]
[object]
A list of downtime recurrences.
duration [required]
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule [required]
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime.
default: UTC
Option 2
object
A one-time downtime definition.
end
date-time
ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the
downtime continues forever.
start
date-time
ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the
downtime starts the moment it is created.
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
data
object
Downtime data.
attributes
object
Downtime details.
canceled
date-time
Time that the downtime was canceled.
created
date-time
Creation time of the downtime.
display_timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
modified
date-time
Time that the downtime was last modified.
monitor_identifier
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules:
one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are
provided, the downtime will begin immediately and never end.
Option 1
object
A recurring downtime schedule definition.
current_downtime
object
The most recent actual start and end dates for a recurring downtime. For a canceled downtime,
this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled
downtimes it is the upcoming downtime.
end
date-time
The end of the current downtime.
start
date-time
The start of the current downtime.
recurrences [required]
[object]
A list of downtime recurrences.
duration
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime. This affects recurring start and end dates.
Must match display_timezone.
{"data":{"attributes":{"canceled":"2020-01-02T03:04:05.282979+0000","created":"2020-01-02T03:04:05.282979+0000","display_timezone":"America/New_York","message":"Message about the downtime","modified":"2020-01-02T03:04:05.282979+0000","monitor_identifier":{"monitor_id":123},"mute_first_recovery_notification":false,"notify_end_states":["alert","warn"],"notify_end_types":["canceled","expired"],"schedule":{"current_downtime":{"end":"2020-01-02T03:04:00.000Z","start":"2020-01-02T03:04:00.000Z"},"recurrences":[{"duration":"123d","rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","start":"2020-01-02T03:04"}],"timezone":"America/New_York"},"scope":"env:(staging OR prod) AND datacenter:us-east-1","status":"active"},"id":"00000000-0000-1234-0000-000000000000","relationships":{"created_by":{"data":{"id":"00000000-0000-1234-0000-000000000000","type":"users"}},"monitor":{"data":{"id":"12345","type":"monitors"}}},"type":"downtime"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","mfa_enabled":false,"modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Schedule a downtime returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);constparams: v2.DowntimesApiCreateDowntimeRequest={body:{data:{attributes:{message:"dark forest",monitorIdentifier:{monitorTags:["cat:hat"],},scope:"test:exampledowntime",schedule:{start: undefined,},},type:"downtime",},},};apiInstance.createDowntime(params).then((data: v2.DowntimeResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
// Cancel downtimes by scope returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "downtime" in the system
DowntimeScope0:=os.Getenv("DOWNTIME_SCOPE_0")body:=datadogV1.CancelDowntimesByScopeRequest{Scope:DowntimeScope0,}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.CancelDowntimesByScope(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CancelDowntimesByScope`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.CancelDowntimesByScope`:\n%s\n",responseContent)}
// Cancel downtimes by scope returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.CancelDowntimesByScopeRequest;importcom.datadog.api.client.v1.model.CanceledDowntimesIds;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime" in the systemStringDOWNTIME_SCOPE_0=System.getenv("DOWNTIME_SCOPE_0");CancelDowntimesByScopeRequestbody=newCancelDowntimesByScopeRequest().scope(DOWNTIME_SCOPE_0);try{CanceledDowntimesIdsresult=apiInstance.cancelDowntimesByScope(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#cancelDowntimesByScope");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apioptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Cancel all downtimes with scopeapi.Downtime.cancel_downtime_by_scope('env:testing')
"""
Cancel downtimes by scope returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.cancel_downtimes_by_scope_requestimportCancelDowntimesByScopeRequest# there is a valid "downtime" in the systemDOWNTIME_SCOPE_0=environ["DOWNTIME_SCOPE_0"]body=CancelDowntimesByScopeRequest(scope=DOWNTIME_SCOPE_0,)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.cancel_downtimes_by_scope(body=body)print(response)
require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Cancel all downtimes with the given scopedog.cancel_downtime_by_scope('env:testing')
# Cancel downtimes by scope returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.new# there is a valid "downtime" in the systemDOWNTIME_SCOPE_0=ENV["DOWNTIME_SCOPE_0"]body=DatadogAPIClient::V1::CancelDowntimesByScopeRequest.new({scope:DOWNTIME_SCOPE_0,})papi_instance.cancel_downtimes_by_scope(body)
// Cancel downtimes by scope returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::CancelDowntimesByScopeRequest;#[tokio::main]asyncfnmain(){// there is a valid "downtime" in the system
letdowntime_scope_0=std::env::var("DOWNTIME_SCOPE_0").unwrap();letbody=CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.cancel_downtimes_by_scope(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cancel downtimes by scope returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);// there is a valid "downtime" in the system
constDOWNTIME_SCOPE_0=process.env.DOWNTIME_SCOPE_0asstring;constparams: v1.DowntimesApiCancelDowntimesByScopeRequest={body:{scope: DOWNTIME_SCOPE_0,},};apiInstance.cancelDowntimesByScope(params).then((data: v1.CanceledDowntimesIds)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Cancel a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApi# there is a valid "downtime" in the systemDOWNTIME_ID=environ["DOWNTIME_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)api_instance.cancel_downtime(downtime_id=int(DOWNTIME_ID),)
# Cancel a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.new# there is a valid "downtime" in the systemDOWNTIME_ID=ENV["DOWNTIME_ID"]api_instance.cancel_downtime(DOWNTIME_ID.to_i)
// Cancel a downtime returns "OK" response
packagemainimport("context""fmt""os""strconv""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "downtime" in the system
DowntimeID,_:=strconv.ParseInt(os.Getenv("DOWNTIME_ID"),10,64)ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)r,err:=api.CancelDowntime(ctx,DowntimeID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CancelDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Cancel a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime" in the systemLongDOWNTIME_ID=Long.parseLong(System.getenv("DOWNTIME_ID"));try{apiInstance.cancelDowntime(DOWNTIME_ID);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#cancelDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Cancel a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;#[tokio::main]asyncfnmain(){// there is a valid "downtime" in the system
letdowntime_id: i64=std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.cancel_downtime(downtime_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cancel a downtime returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);// there is a valid "downtime" in the system
constDOWNTIME_ID=parseInt(process.env.DOWNTIME_IDasstring);constparams: v1.DowntimesApiCancelDowntimeRequest={downtimeId: DOWNTIME_ID,};apiInstance.cancelDowntime(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Cancel a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.downtimes_apiimportDowntimesApi# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=environ["DOWNTIME_V2_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)api_instance.cancel_downtime(downtime_id=DOWNTIME_V2_DATA_ID,)
# Cancel a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::DowntimesAPI.new# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=ENV["DOWNTIME_V2_DATA_ID"]api_instance.cancel_downtime(DOWNTIME_V2_DATA_ID)
// Cancel a downtime returns "OK" response
packagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "downtime_v2" in the system
DowntimeV2DataID:=os.Getenv("DOWNTIME_V2_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDowntimesApi(apiClient)r,err:=api.CancelDowntime(ctx,DowntimeV2DataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.CancelDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Cancel a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DowntimesApi;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime_v2" in the systemStringDOWNTIME_V2_DATA_ID=System.getenv("DOWNTIME_V2_DATA_ID");try{apiInstance.cancelDowntime(DOWNTIME_V2_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#cancelDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Cancel a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_downtimes::DowntimesAPI;#[tokio::main]asyncfnmain(){// there is a valid "downtime_v2" in the system
letdowntime_v2_data_id=std::env::var("DOWNTIME_V2_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.cancel_downtime(downtime_v2_data_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cancel a downtime returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);// there is a valid "downtime_v2" in the system
constDOWNTIME_V2_DATA_ID=process.env.DOWNTIME_V2_DATA_IDasstring;constparams: v2.DowntimesApiCancelDowntimeRequest={downtimeId: DOWNTIME_V2_DATA_ID,};apiInstance.cancelDowntime(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
active
boolean
If a scheduled downtime currently exists.
active_child
object
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
{"active":true,"active_child":{"active":true,"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1626,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456},"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1625,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456}
"""
Get a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApi# there is a valid "downtime" in the systemDOWNTIME_ID=environ["DOWNTIME_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.get_downtime(downtime_id=int(DOWNTIME_ID),)print(response)
# Get a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.new# there is a valid "downtime" in the systemDOWNTIME_ID=ENV["DOWNTIME_ID"]papi_instance.get_downtime(DOWNTIME_ID.to_i)
require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Get a downtime objectdowntime_id=1625dog.get_downtime(downtime_id)
// Get a downtime returns "OK" response
packagemainimport("context""encoding/json""fmt""os""strconv""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "downtime" in the system
DowntimeID,_:=strconv.ParseInt(os.Getenv("DOWNTIME_ID"),10,64)ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.GetDowntime(ctx,DowntimeID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.GetDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.GetDowntime`:\n%s\n",responseContent)}
// Get a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime" in the systemLongDOWNTIME_ID=Long.parseLong(System.getenv("DOWNTIME_ID"));try{Downtimeresult=apiInstance.getDowntime(DOWNTIME_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#getDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apioptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Get a downtimeapi.Downtime.get(2910)
// Get a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;#[tokio::main]asyncfnmain(){// there is a valid "downtime" in the system
letdowntime_id: i64=std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.get_downtime(downtime_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a downtime returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);// there is a valid "downtime" in the system
constDOWNTIME_ID=parseInt(process.env.DOWNTIME_IDasstring);constparams: v1.DowntimesApiGetDowntimeRequest={downtimeId: DOWNTIME_ID,};apiInstance.getDowntime(params).then((data: v1.Downtime)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
data
object
Downtime data.
attributes
object
Downtime details.
canceled
date-time
Time that the downtime was canceled.
created
date-time
Creation time of the downtime.
display_timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
modified
date-time
Time that the downtime was last modified.
monitor_identifier
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules:
one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are
provided, the downtime will begin immediately and never end.
Option 1
object
A recurring downtime schedule definition.
current_downtime
object
The most recent actual start and end dates for a recurring downtime. For a canceled downtime,
this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled
downtimes it is the upcoming downtime.
end
date-time
The end of the current downtime.
start
date-time
The start of the current downtime.
recurrences [required]
[object]
A list of downtime recurrences.
duration
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime. This affects recurring start and end dates.
Must match display_timezone.
{"data":{"attributes":{"canceled":"2020-01-02T03:04:05.282979+0000","created":"2020-01-02T03:04:05.282979+0000","display_timezone":"America/New_York","message":"Message about the downtime","modified":"2020-01-02T03:04:05.282979+0000","monitor_identifier":{"monitor_id":123},"mute_first_recovery_notification":false,"notify_end_states":["alert","warn"],"notify_end_types":["canceled","expired"],"schedule":{"current_downtime":{"end":"2020-01-02T03:04:00.000Z","start":"2020-01-02T03:04:00.000Z"},"recurrences":[{"duration":"123d","rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","start":"2020-01-02T03:04"}],"timezone":"America/New_York"},"scope":"env:(staging OR prod) AND datacenter:us-east-1","status":"active"},"id":"00000000-0000-1234-0000-000000000000","relationships":{"created_by":{"data":{"id":"00000000-0000-1234-0000-000000000000","type":"users"}},"monitor":{"data":{"id":"12345","type":"monitors"}}},"type":"downtime"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","mfa_enabled":false,"modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
"""
Get a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.downtimes_apiimportDowntimesApi# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=environ["DOWNTIME_V2_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.get_downtime(downtime_id=DOWNTIME_V2_DATA_ID,)print(response)
# Get a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::DowntimesAPI.new# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=ENV["DOWNTIME_V2_DATA_ID"]papi_instance.get_downtime(DOWNTIME_V2_DATA_ID)
// Get a downtime returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "downtime_v2" in the system
DowntimeV2DataID:=os.Getenv("DOWNTIME_V2_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDowntimesApi(apiClient)resp,r,err:=api.GetDowntime(ctx,DowntimeV2DataID,*datadogV2.NewGetDowntimeOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.GetDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.GetDowntime`:\n%s\n",responseContent)}
// Get a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DowntimesApi;importcom.datadog.api.client.v2.model.DowntimeResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime_v2" in the systemStringDOWNTIME_V2_DATA_ID=System.getenv("DOWNTIME_V2_DATA_ID");try{DowntimeResponseresult=apiInstance.getDowntime(DOWNTIME_V2_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#getDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV2::api_downtimes::GetDowntimeOptionalParams;#[tokio::main]asyncfnmain(){// there is a valid "downtime_v2" in the system
letdowntime_v2_data_id=std::env::var("DOWNTIME_V2_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.get_downtime(downtime_v2_data_id.clone(),GetDowntimeOptionalParams::default(),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a downtime returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);// there is a valid "downtime_v2" in the system
constDOWNTIME_V2_DATA_ID=process.env.DOWNTIME_V2_DATA_IDasstring;constparams: v2.DowntimesApiGetDowntimeRequest={downtimeId: DOWNTIME_V2_DATA_ID,};apiInstance.getDowntime(params).then((data: v2.DowntimeResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
active
boolean
If a scheduled downtime currently exists.
active_child
object
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
{"active":true,"active_child":{"active":true,"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1626,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456},"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1625,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456}
// Update a downtime returns "OK" response
packagemainimport("context""encoding/json""fmt""os""strconv""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){// there is a valid "downtime" in the system
DowntimeID,_:=strconv.ParseInt(os.Getenv("DOWNTIME_ID"),10,64)body:=datadogV1.Downtime{Message:*datadog.NewNullableString(datadog.PtrString("Example-Downtime-updated")),MuteFirstRecoveryNotification:datadog.PtrBool(true),NotifyEndStates:[]datadogV1.NotifyEndState{datadogV1.NOTIFYENDSTATE_ALERT,datadogV1.NOTIFYENDSTATE_NO_DATA,datadogV1.NOTIFYENDSTATE_WARN,},NotifyEndTypes:[]datadogV1.NotifyEndType{datadogV1.NOTIFYENDTYPE_CANCELED,datadogV1.NOTIFYENDTYPE_EXPIRED,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.UpdateDowntime(ctx,DowntimeID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.UpdateDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.UpdateDowntime`:\n%s\n",responseContent)}
// Update a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;importcom.datadog.api.client.v1.model.NotifyEndState;importcom.datadog.api.client.v1.model.NotifyEndType;importjava.util.Arrays;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime" in the systemLongDOWNTIME_ID=Long.parseLong(System.getenv("DOWNTIME_ID"));Downtimebody=newDowntime().message("Example-Downtime-updated").muteFirstRecoveryNotification(true).notifyEndStates(Arrays.asList(NotifyEndState.ALERT,NotifyEndState.NO_DATA,NotifyEndState.WARN)).notifyEndTypes(Arrays.asList(NotifyEndType.CANCELED,NotifyEndType.EXPIRED));try{Downtimeresult=apiInstance.updateDowntime(DOWNTIME_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#updateDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v1.model.downtimeimportDowntimefromdatadog_api_client.v1.model.notify_end_stateimportNotifyEndStatefromdatadog_api_client.v1.model.notify_end_typeimportNotifyEndType# there is a valid "downtime" in the systemDOWNTIME_ID=environ["DOWNTIME_ID"]body=Downtime(message="Example-Downtime-updated",mute_first_recovery_notification=True,notify_end_states=[NotifyEndState.ALERT,NotifyEndState.NO_DATA,NotifyEndState.WARN,],notify_end_types=[NotifyEndType.CANCELED,NotifyEndType.EXPIRED,],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.update_downtime(downtime_id=int(DOWNTIME_ID),body=body)print(response)
# Update a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.new# there is a valid "downtime" in the systemDOWNTIME_ID=ENV["DOWNTIME_ID"]body=DatadogAPIClient::V1::Downtime.new({message:"Example-Downtime-updated",mute_first_recovery_notification:true,notify_end_states:[DatadogAPIClient::V1::NotifyEndState::ALERT,DatadogAPIClient::V1::NotifyEndState::NO_DATA,DatadogAPIClient::V1::NotifyEndState::WARN,],notify_end_types:[DatadogAPIClient::V1::NotifyEndType::CANCELED,DatadogAPIClient::V1::NotifyEndType::EXPIRED,],})papi_instance.update_downtime(DOWNTIME_ID.to_i,body)
// Update a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV1::model::Downtime;usedatadog_api_client::datadogV1::model::NotifyEndState;usedatadog_api_client::datadogV1::model::NotifyEndType;#[tokio::main]asyncfnmain(){// there is a valid "downtime" in the system
letdowntime_id: i64=std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();letbody=Downtime::new().message(Some("Example-Downtime-updated".to_string())).mute_first_recovery_notification(true).notify_end_states(vec![NotifyEndState::ALERT,NotifyEndState::NO_DATA,NotifyEndState::WARN,]).notify_end_types(vec![NotifyEndType::CANCELED,NotifyEndType::EXPIRED]);letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.update_downtime(downtime_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update a downtime returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);// there is a valid "downtime" in the system
constDOWNTIME_ID=parseInt(process.env.DOWNTIME_IDasstring);constparams: v1.DowntimesApiUpdateDowntimeRequest={body:{message:"Example-Downtime-updated",muteFirstRecoveryNotification: true,notifyEndStates:["alert","no data","warn"],notifyEndTypes:["canceled","expired"],},downtimeId: DOWNTIME_ID,};apiInstance.updateDowntime(params).then((data: v1.Downtime)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
monitor_identifier
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
Schedule for the downtime.
Option 1
object
A recurring downtime schedule definition.
recurrences
[object]
A list of downtime recurrences.
duration [required]
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule [required]
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime.
default: UTC
Option 2
object
A one-time downtime definition.
end
date-time
ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the
downtime continues forever.
start
date-time
ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the
downtime starts the moment it is created.
Downtiming gives you greater control over monitor notifications by
allowing you to globally exclude scopes from alerting.
Downtime settings, which can be scheduled with start and end times,
prevent all alerting related to specified Datadog tags.
Expand All
Champ
Type
Description
data
object
Downtime data.
attributes
object
Downtime details.
canceled
date-time
Time that the downtime was canceled.
created
date-time
Creation time of the downtime.
display_timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications. This is not used
as an offset for scheduling.
default: UTC
message
string
A message to include with notifications for this downtime. Email notifications can be sent to specific users
by using the same @username notation as events.
modified
date-time
Time that the downtime was last modified.
monitor_identifier
<oneOf>
Monitor identifier for the downtime.
Option 1
object
Object of the monitor identifier.
monitor_id [required]
int64
ID of the monitor to prevent notifications.
Option 2
object
Object of the monitor tags.
monitor_tags [required]
[string]
A list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match all provided monitor tags. Setting monitor_tags
to [*] configures the downtime to mute all monitors for the given scope.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States that will trigger a monitor notification when the notify_end_types action occurs.
notify_end_types
[string]
Actions that will trigger a monitor notification if the downtime is in the notify_end_types state.
schedule
<oneOf>
The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules:
one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules are
provided, the downtime will begin immediately and never end.
Option 1
object
A recurring downtime schedule definition.
current_downtime
object
The most recent actual start and end dates for a recurring downtime. For a canceled downtime,
this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled
downtimes it is the upcoming downtime.
end
date-time
The end of the current downtime.
start
date-time
The start of the current downtime.
recurrences [required]
[object]
A list of downtime recurrences.
duration
string
The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'.
rrule
string
The RRULE standard for defining recurring events.
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide.
start
string
ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the
downtime starts the moment it is created.
timezone
string
The timezone in which to schedule the downtime. This affects recurring start and end dates.
Must match display_timezone.
{"data":{"attributes":{"canceled":"2020-01-02T03:04:05.282979+0000","created":"2020-01-02T03:04:05.282979+0000","display_timezone":"America/New_York","message":"Message about the downtime","modified":"2020-01-02T03:04:05.282979+0000","monitor_identifier":{"monitor_id":123},"mute_first_recovery_notification":false,"notify_end_states":["alert","warn"],"notify_end_types":["canceled","expired"],"schedule":{"current_downtime":{"end":"2020-01-02T03:04:00.000Z","start":"2020-01-02T03:04:00.000Z"},"recurrences":[{"duration":"123d","rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","start":"2020-01-02T03:04"}],"timezone":"America/New_York"},"scope":"env:(staging OR prod) AND datacenter:us-east-1","status":"active"},"id":"00000000-0000-1234-0000-000000000000","relationships":{"created_by":{"data":{"id":"00000000-0000-1234-0000-000000000000","type":"users"}},"monitor":{"data":{"id":"12345","type":"monitors"}}},"type":"downtime"},"included":[{"attributes":{"created_at":"2019-09-19T10:00:00.000Z","disabled":false,"email":"string","handle":"string","icon":"string","mfa_enabled":false,"modified_at":"2019-09-19T10:00:00.000Z","name":"string","service_account":false,"status":"string","title":"string","verified":false},"id":"string","relationships":{"org":{"data":{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}},"other_orgs":{"data":[{"id":"00000000-0000-beef-0000-000000000000","type":"orgs"}]},"other_users":{"data":[{"id":"00000000-0000-0000-2345-000000000000","type":"users"}]},"roles":{"data":[{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}]}},"type":"users"}]}
// Update a downtime returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "downtime_v2" in the system
DowntimeV2DataID:=os.Getenv("DOWNTIME_V2_DATA_ID")body:=datadogV2.DowntimeUpdateRequest{Data:datadogV2.DowntimeUpdateRequestData{Attributes:datadogV2.DowntimeUpdateRequestAttributes{Message:*datadog.NewNullableString(datadog.PtrString("light speed")),},Id:DowntimeV2DataID,Type:datadogV2.DOWNTIMERESOURCETYPE_DOWNTIME,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDowntimesApi(apiClient)resp,r,err:=api.UpdateDowntime(ctx,DowntimeV2DataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.UpdateDowntime`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.UpdateDowntime`:\n%s\n",responseContent)}
// Update a downtime returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DowntimesApi;importcom.datadog.api.client.v2.model.DowntimeResourceType;importcom.datadog.api.client.v2.model.DowntimeResponse;importcom.datadog.api.client.v2.model.DowntimeUpdateRequest;importcom.datadog.api.client.v2.model.DowntimeUpdateRequestAttributes;importcom.datadog.api.client.v2.model.DowntimeUpdateRequestData;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);// there is a valid "downtime_v2" in the systemStringDOWNTIME_V2_DATA_ID=System.getenv("DOWNTIME_V2_DATA_ID");DowntimeUpdateRequestbody=newDowntimeUpdateRequest().data(newDowntimeUpdateRequestData().attributes(newDowntimeUpdateRequestAttributes().message("light speed")).id(DOWNTIME_V2_DATA_ID).type(DowntimeResourceType.DOWNTIME));try{DowntimeResponseresult=apiInstance.updateDowntime(DOWNTIME_V2_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#updateDowntime");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a downtime returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.downtimes_apiimportDowntimesApifromdatadog_api_client.v2.model.downtime_resource_typeimportDowntimeResourceTypefromdatadog_api_client.v2.model.downtime_update_requestimportDowntimeUpdateRequestfromdatadog_api_client.v2.model.downtime_update_request_attributesimportDowntimeUpdateRequestAttributesfromdatadog_api_client.v2.model.downtime_update_request_dataimportDowntimeUpdateRequestData# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=environ["DOWNTIME_V2_DATA_ID"]body=DowntimeUpdateRequest(data=DowntimeUpdateRequestData(attributes=DowntimeUpdateRequestAttributes(message="light speed",),id=DOWNTIME_V2_DATA_ID,type=DowntimeResourceType.DOWNTIME,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.update_downtime(downtime_id=DOWNTIME_V2_DATA_ID,body=body)print(response)
# Update a downtime returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::DowntimesAPI.new# there is a valid "downtime_v2" in the systemDOWNTIME_V2_DATA_ID=ENV["DOWNTIME_V2_DATA_ID"]body=DatadogAPIClient::V2::DowntimeUpdateRequest.new({data:DatadogAPIClient::V2::DowntimeUpdateRequestData.new({attributes:DatadogAPIClient::V2::DowntimeUpdateRequestAttributes.new({message:"light speed",}),id:DOWNTIME_V2_DATA_ID,type:DatadogAPIClient::V2::DowntimeResourceType::DOWNTIME,}),})papi_instance.update_downtime(DOWNTIME_V2_DATA_ID,body)
// Update a downtime returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV2::model::DowntimeResourceType;usedatadog_api_client::datadogV2::model::DowntimeUpdateRequest;usedatadog_api_client::datadogV2::model::DowntimeUpdateRequestAttributes;usedatadog_api_client::datadogV2::model::DowntimeUpdateRequestData;#[tokio::main]asyncfnmain(){// there is a valid "downtime_v2" in the system
letdowntime_v2_data_id=std::env::var("DOWNTIME_V2_DATA_ID").unwrap();letbody=DowntimeUpdateRequest::new(DowntimeUpdateRequestData::new(DowntimeUpdateRequestAttributes::new().message(Some("light speed".to_string())),downtime_v2_data_id.clone(),DowntimeResourceType::DOWNTIME,));letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.update_downtime(downtime_v2_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update a downtime returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);// there is a valid "downtime_v2" in the system
constDOWNTIME_V2_DATA_ID=process.env.DOWNTIME_V2_DATA_IDasstring;constparams: v2.DowntimesApiUpdateDowntimeRequest={body:{data:{attributes:{message:"light speed",},id: DOWNTIME_V2_DATA_ID,type:"downtime",},},downtimeId: DOWNTIME_V2_DATA_ID,};apiInstance.updateDowntime(params).then((data: v2.DowntimeResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The downtime object definition of the active child for the original parent recurring downtime. This
field will only exist on recurring downtimes.
active
boolean
If a scheduled downtime currently exists.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
canceled
int64
If a scheduled downtime is canceled.
creator_id
int32
User ID of the downtime creator.
disabled
boolean
If a downtime has been disabled.
downtime_type
int32
0 for a downtime applied on * or all,
1 when the downtime is only scoped to hosts,
or 2 when the downtime is scoped to anything but hosts.
end
int64
POSIX timestamp to end the downtime. If not provided,
the downtime is in effect indefinitely until you cancel it.
id
int64
The downtime ID.
message
string
A message to include with notifications for this downtime.
Email notifications can be sent to specific users by using the same @username notation as events.
monitor_id
int64
A single monitor to which the downtime applies.
If not provided, the downtime applies to all monitors.
monitor_tags
[string]
A comma-separated list of monitor tags. For example, tags that are applied directly to monitors,
not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies.
The resulting downtime applies to monitors that match ALL provided monitor tags.
For example, service:postgresANDteam:frontend.
mute_first_recovery_notification
boolean
If the first recovery notification during a downtime should be muted.
notify_end_states
[string]
States for which notify_end_types sends out notifications for.
default: alert,no data,warn
notify_end_types
[string]
If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA)
when this downtime expires or is canceled. Applied to monitors that change states during
the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that
already have an alert-worthy state when downtime begins.
default: expired
parent_id
int64
ID of the parent Downtime.
recurrence
object
An object defining the recurrence of the downtime.
period
int32
How often to repeat as an integer.
For example, to repeat every 3 days, select a type of days and a period of 3.
rrule
string
The RRULE standard for defining recurring events (requires to set "type" to rrule)
For example, to have a recurring event on the first day of each month, set the type to rrule and set the FREQ to MONTHLY and BYMONTHDAY to 1.
Most common rrule options from the iCalendar Spec are supported.
Note: Attributes specifying the duration in RRULE are not supported (for example, DTSTART, DTEND, DURATION).
More examples available in this downtime guide
type
string
The type of recurrence. Choose from days, weeks, months, years, rrule.
until_date
int64
The date at which the recurrence should end as a POSIX timestamp.
until_occurences and until_date are mutually exclusive.
until_occurrences
int32
How many times the downtime is rescheduled.
until_occurences and until_date are mutually exclusive.
week_days
[string]
A list of week days to repeat on. Choose from Mon, Tue, Wed, Thu, Fri, Sat or Sun.
Only applicable when type is weeks. First letter must be capitalized.
scope
[string]
The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2.
Provide multiple scopes as a comma-separated list like env:dev,env:prod.
The resulting downtime applies to sources that matches ALL provided scopes (env:devANDenv:prod).
start
int64
POSIX timestamp to start the downtime.
If not provided, the downtime starts the moment it is created.
timezone
string
The timezone in which to display the downtime's start and end times in Datadog applications.
updater_id
int32
ID of the last user that updated the downtime.
{"active":true,"active_child":{"active":true,"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1626,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456},"canceled":1412799983,"creator_id":123456,"disabled":false,"downtime_type":2,"end":1412793983,"id":1625,"message":"Message on the downtime","monitor_id":123456,"monitor_tags":["*"],"mute_first_recovery_notification":false,"notify_end_states":["alert","no data","warn"],"notify_end_types":["canceled","expired"],"parent_id":123,"recurrence":{"period":1,"rrule":"FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1","type":"weeks","until_date":1447786293,"until_occurrences":2,"week_days":["Mon","Tue"]},"scope":["env:staging"],"start":1412792983,"timezone":"America/New_York","updater_id":123456}
"""
Get active downtimes for a monitor returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.downtimes_apiimportDowntimesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.list_monitor_downtimes(monitor_id=9223372036854775807,)print(response)
# Get active downtimes for a monitor returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::DowntimesAPI.newpapi_instance.list_monitor_downtimes(9223372036854775807)
// Get active downtimes for a monitor returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewDowntimesApi(apiClient)resp,r,err:=api.ListMonitorDowntimes(ctx,9223372036854775807)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.ListMonitorDowntimes`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.ListMonitorDowntimes`:\n%s\n",responseContent)}
// Get active downtimes for a monitor returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.DowntimesApi;importcom.datadog.api.client.v1.model.Downtime;importjava.util.List;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);try{List<Downtime>result=apiInstance.listMonitorDowntimes(9223372036854775807L);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#listMonitorDowntimes");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get active downtimes for a monitor returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_downtimes::DowntimesAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.list_monitor_downtimes(9223372036854775807).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get active downtimes for a monitor returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.DowntimesApi(configuration);constparams: v1.DowntimesApiListMonitorDowntimesRequest={monitorId: 9223372036854775807,};apiInstance.listMonitorDowntimes(params).then((data: v1.Downtime[])=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Monitor Downtime Match resource type.
Allowed enum values: downtime_match
default: downtime_match
meta
object
Pagination metadata returned by the API.
page
object
Object containing the total filtered count.
total_filtered_count
int64
Total count of elements matched by the filter.
{"data":[{"attributes":{"end":"2020-01-02T03:04:00.000Z","groups":["service:postgres","team:frontend"],"scope":"env:(staging OR prod) AND datacenter:us-east-1","start":"2020-01-02T03:04:00.000Z"},"id":"00000000-0000-1234-0000-000000000000","type":"downtime_match"}],"meta":{"page":{"total_filtered_count":"integer"}}}
"""
Get active downtimes for a monitor returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.downtimes_apiimportDowntimesApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=DowntimesApi(api_client)response=api_instance.list_monitor_downtimes(monitor_id=35534610,)print(response)
# Get active downtimes for a monitor returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::DowntimesAPI.newpapi_instance.list_monitor_downtimes(35534610)
// Get active downtimes for a monitor returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDowntimesApi(apiClient)resp,r,err:=api.ListMonitorDowntimes(ctx,35534610,*datadogV2.NewListMonitorDowntimesOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DowntimesApi.ListMonitorDowntimes`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DowntimesApi.ListMonitorDowntimes`:\n%s\n",responseContent)}
// Get active downtimes for a monitor returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DowntimesApi;importcom.datadog.api.client.v2.model.MonitorDowntimeMatchResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();DowntimesApiapiInstance=newDowntimesApi(defaultClient);try{MonitorDowntimeMatchResponseresult=apiInstance.listMonitorDowntimes(35534610L);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DowntimesApi#listMonitorDowntimes");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get active downtimes for a monitor returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_downtimes::DowntimesAPI;usedatadog_api_client::datadogV2::api_downtimes::ListMonitorDowntimesOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=DowntimesAPI::with_config(configuration);letresp=api.list_monitor_downtimes(35534610,ListMonitorDowntimesOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get active downtimes for a monitor returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.DowntimesApi(configuration);constparams: v2.DowntimesApiListMonitorDowntimesRequest={monitorId: 35534610,};apiInstance.listMonitorDowntimes(params).then((data: v2.MonitorDowntimeMatchResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));