Downtimes

Downtimes

Les downtimes vous permettent de mieux contrôler les notifications d’un monitor 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.

GET https://api.datadoghq.eu/api/v1/downtimehttps://api.ddog-gov.com/api/v1/downtimehttps://api.datadoghq.com/api/v1/downtimehttps://api.us3.datadoghq.com/api/v1/downtime

Présentation

Récupérez tous les downtimes planifiés.

Arguments

Chaînes de requête

Nom

Type

Description

current_only

boolean

Only return downtimes that are active when the request is made.

Réponse

OK

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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": [
      "*"
    ],
    "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": [
    "*"
  ],
  "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
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    currentOnly := true // bool | Only return downtimes that are active when the request is made. (optional)
    optionalParams := datadog.ListDowntimesOptionalParameters{
        CurrentOnly: &currentOnly,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.ListDowntimes(ctx, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.ListDowntimes`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListDowntimes`: []Downtime
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.ListDowntimes:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    current_only = True  # bool | Only return downtimes that are active when the request is made. (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get all downtimes
        api_response = api_instance.list_downtimes(current_only=current_only)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->list_downtimes: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
opts = {
  current_only: true # Boolean | Only return downtimes that are active when the request is made.
}

begin
  # Get all downtimes
  result = api_instance.list_downtimes(opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->list_downtimes: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiListDowntimesRequest = {
  // boolean | Only return downtimes that are active when the request is made. (optional)
  currentOnly: true,
};

apiInstance.listDowntimes(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Boolean currentOnly = true; // Boolean | Only return downtimes that are active when the request is made.
        try {
	    List<Downtime> result = apiInstance.listDowntimes(new DowntimesApi.ListDowntimesOptionalParameters()
                .currentOnly(currentOnly));
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

# Get all downtimes
print(api.Downtime.get_all())

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

# Get all downtimes
dog.get_all_downtimes

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

POST https://api.datadoghq.eu/api/v1/downtimehttps://api.ddog-gov.com/api/v1/downtimehttps://api.datadoghq.com/api/v1/downtimehttps://api.us3.datadoghq.com/api/v1/downtime

Présentation

Planifiez un downtime.

Requête

Body Data (required)

Corps de requête pour la planification d’un downtime.

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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.

{
  "disabled": false,
  "end": 1412793983,
  "message": "Message on the downtime",
  "monitor_id": 123456,
  "monitor_tags": [
    "*"
  ],
  "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"
}

Réponse

OK

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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": [
      "*"
    ],
    "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": [
    "*"
  ],
  "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
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{}
EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    body := *datadog.NewDowntime() // Downtime | Schedule a downtime request body.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.CreateDowntime(ctx, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.CreateDowntime`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateDowntime`: Downtime
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.CreateDowntime:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    body = Downtime(
        active=True,
        active_child=DowntimeChild(
            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=["*"],
            parent_id=123,
            recurrence=DowntimeRecurrence(
                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=["*"],
        parent_id=123,
        recurrence=DowntimeRecurrence(
            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,
    )  # Downtime | Schedule a downtime request body.

    # example passing only required values which don't have defaults set
    try:
        # Schedule a downtime
        api_response = api_instance.create_downtime(body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->create_downtime: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
body = DatadogAPIClient::V1::Downtime.new # Downtime | Schedule a downtime request body.

begin
  # Schedule a downtime
  result = api_instance.create_downtime(body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->create_downtime: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiCreateDowntimeRequest = {
  // Downtime | Schedule a downtime request body.
  body: {
    disabled: false,
    end: 1412793983,
    message: "Message on the downtime",
    monitorId: 123456,
    monitorTags: ["*"],
    parentId: 123,
    recurrence: {
      period: 1,
      rrule: "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1",
      type: "weeks",
      untilDate: 1447786293,
      untilOccurrences: 2,
      weekDays: ["Mon","Tue"],
    },
    scope: ["env:staging"],
    start: 1412792983,
    timezone: "America/New_York",
  },
};

apiInstance.createDowntime(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Downtime body = new Downtime(); // Downtime | Schedule a downtime request body.
        try {
            Downtime result = apiInstance.createDowntime(body);
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
from datadog import initialize, api
import time

options = {
    '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 now

recurrence = {
    'type': 'weeks',
    'period': 1,
    'week_days': ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
    'until_date': end_reccurrence_ts
}

# Schedule downtime
api.Downtime.create(
    scope='env:staging',
    start=start_ts,
    end=end_ts,
    recurrence=recurrence
)

# OR use RRULE reccurence
rrule_recurrence = {
    'type': 'rrule',
    'rrule': 'FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1',
}

# Schedule downtime
api.Downtime.create(
    scope='env:staging',
    start=start_ts,
    end=end_ts,
    recurrence=rrule_recurrence
)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"
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_i
end_ts = start_ts + (3 * 60 * 60)
end_reccurrence_ts = start_ts + (4 * 7 * 24 * 60 * 60) # 4 weeks from now

recurrence = {
    'type' => 'weeks',
    'period' => 1,
    'week_days' => %w[Mon Tue Wed Thu Fri],
    'until_date' => end_reccurrence_ts
}

# Schedule downtime
dog.Downtime.create(
    'env:staging',
    start: start_ts,
    end: end_ts,
    recurrence: recurrence
)

# OR use RRULE reccurence
rrule_recurrence = {
    'type' => 'rrule',
    'rrule' => 'FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1',
}

# Schedule downtime
dog.Downtime.create(
    'env:staging',
    start: start_ts,
    end: end_ts,
    recurrence: rrule_recurrence
)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

POST https://api.datadoghq.eu/api/v1/downtime/cancel/by_scopehttps://api.ddog-gov.com/api/v1/downtime/cancel/by_scopehttps://api.datadoghq.com/api/v1/downtime/cancel/by_scopehttps://api.us3.datadoghq.com/api/v1/downtime/cancel/by_scope

Présentation

Supprimez tous les downtimes correspondant au contexte X.

Requête

Body Data (required)

Contexte pour l’annulation des downtimes.

Expand All

Champ

Type

Description

scope [required]

string

The scope(s) to which the downtime applies. 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:dev AND env:prod).

{
  "scope": "host:myserver"
}

Réponse

OK

Object containing array of IDs of canceled downtimes.

Expand All

Champ

Type

Description

cancelled_ids

[integer]

ID of downtimes that were canceled.

{
  "cancelled_ids": [
    123456789,
    123456790
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Downtimes not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime/cancel/by_scope" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "scope": "host:myserver"
}
EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    body := *datadog.NewCancelDowntimesByScopeRequest("host:myserver") // CancelDowntimesByScopeRequest | Scope to cancel downtimes for.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.CancelDowntimesByScope(ctx, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.CancelDowntimesByScope`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CancelDowntimesByScope`: CanceledDowntimesIds
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.CancelDowntimesByScope:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    body = CancelDowntimesByScopeRequest(
        scope="host:myserver",
    )  # CancelDowntimesByScopeRequest | Scope to cancel downtimes for.

    # example passing only required values which don't have defaults set
    try:
        # Cancel downtimes by scope
        api_response = api_instance.cancel_downtimes_by_scope(body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->cancel_downtimes_by_scope: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
body = DatadogAPIClient::V1::CancelDowntimesByScopeRequest.new({scope: 'host:myserver'}) # CancelDowntimesByScopeRequest | Scope to cancel downtimes for.

begin
  # Cancel downtimes by scope
  result = api_instance.cancel_downtimes_by_scope(body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->cancel_downtimes_by_scope: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiCancelDowntimesByScopeRequest = {
  // CancelDowntimesByScopeRequest | Scope to cancel downtimes for.
  body: {
    scope: "host:myserver",
  },
};

apiInstance.cancelDowntimesByScope(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        CancelDowntimesByScopeRequest body = new CancelDowntimesByScopeRequest(); // CancelDowntimesByScopeRequest | Scope to cancel downtimes for.
        try {
            CanceledDowntimesIds result = apiInstance.cancelDowntimesByScope(body);
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

# Cancel all downtimes with scope
api.Downtime.cancel_downtime_by_scope('env:testing')

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"
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 scope
dog.cancel_downtime_by_scope('env:testing')

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

DELETE https://api.datadoghq.eu/api/v1/downtime/{downtime_id}https://api.ddog-gov.com/api/v1/downtime/{downtime_id}https://api.datadoghq.com/api/v1/downtime/{downtime_id}https://api.us3.datadoghq.com/api/v1/downtime/{downtime_id}

Présentation

Annulez un downtime.

Arguments

Paramètres du chemin

Nom

Type

Description

downtime_id [required]

integer

ID of the downtime to cancel.

Réponse

OK

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Downtime not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export downtime_id="123456"
# Curl command curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime/${downtime_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    downtimeId := int64(123456) // int64 | ID of the downtime to cancel.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    r, err := apiClient.DowntimesApi.CancelDowntime(ctx, downtimeId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.CancelDowntime`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    downtime_id = 123456  # int | ID of the downtime to cancel.

    # example passing only required values which don't have defaults set
    try:
        # Cancel a downtime
        api_instance.cancel_downtime(downtime_id)
    except ApiException as e:
        print("Exception when calling DowntimesApi->cancel_downtime: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
downtime_id = 123456 # Integer | ID of the downtime to cancel.

begin
  # Cancel a downtime
  api_instance.cancel_downtime(downtime_id)
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->cancel_downtime: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiCancelDowntimeRequest = {
  // number | ID of the downtime to cancel.
  downtimeId: 123456,
};

apiInstance.cancelDowntime(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Long downtimeId = 123456L; // Long | ID of the downtime to cancel.
        try {
            apiInstance.cancelDowntime(downtimeId);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

GET https://api.datadoghq.eu/api/v1/downtime/{downtime_id}https://api.ddog-gov.com/api/v1/downtime/{downtime_id}https://api.datadoghq.com/api/v1/downtime/{downtime_id}https://api.us3.datadoghq.com/api/v1/downtime/{downtime_id}

Présentation

Récupérez les détails d’un downtime par downtime_id.

Arguments

Paramètres du chemin

Nom

Type

Description

downtime_id [required]

integer

ID of the downtime to fetch.

Réponse

OK

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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": [
      "*"
    ],
    "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": [
    "*"
  ],
  "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
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Downtime not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export downtime_id="123456"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime/${downtime_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    downtimeId := int64(123456) // int64 | ID of the downtime to fetch.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.GetDowntime(ctx, downtimeId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.GetDowntime`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetDowntime`: Downtime
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.GetDowntime:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    downtime_id = 123456  # int | ID of the downtime to fetch.

    # example passing only required values which don't have defaults set
    try:
        # Get a downtime
        api_response = api_instance.get_downtime(downtime_id)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->get_downtime: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
downtime_id = 123456 # Integer | ID of the downtime to fetch.

begin
  # Get a downtime
  result = api_instance.get_downtime(downtime_id)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->get_downtime: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiGetDowntimeRequest = {
  // number | ID of the downtime to fetch.
  downtimeId: 123456,
};

apiInstance.getDowntime(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Long downtimeId = 123456L; // Long | ID of the downtime to fetch.
        try {
            Downtime result = apiInstance.getDowntime(downtimeId);
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

# Get a downtime
api.Downtime.get(2910)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python "example.py"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

# Get a downtime object
downtime_id = 1625
dog.get_downtime(downtime_id)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

PUT https://api.datadoghq.eu/api/v1/downtime/{downtime_id}https://api.ddog-gov.com/api/v1/downtime/{downtime_id}https://api.datadoghq.com/api/v1/downtime/{downtime_id}https://api.us3.datadoghq.com/api/v1/downtime/{downtime_id}

Présentation

Mettez à jour un downtime unique par downtime_id.

Arguments

Paramètres du chemin

Nom

Type

Description

downtime_id [required]

integer

ID of the downtime to update.

Requête

Body Data (required)

Corps de requête pour la mise à jour d’un downtime.

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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.

{
  "disabled": false,
  "end": 1412793983,
  "message": "Message on the downtime",
  "monitor_id": 123456,
  "monitor_tags": [
    "*"
  ],
  "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"
}

Réponse

OK

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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": [
      "*"
    ],
    "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": [
    "*"
  ],
  "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
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Downtime not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export downtime_id="123456"
# Curl command curl -X PUT "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/downtime/${downtime_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF {} EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    downtimeId := int64(123456) // int64 | ID of the downtime to update.
    body := *datadog.NewDowntime() // Downtime | Update a downtime request body.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.UpdateDowntime(ctx, downtimeId, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.UpdateDowntime`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateDowntime`: Downtime
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.UpdateDowntime:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    downtime_id = 123456  # int | ID of the downtime to update.
    body = Downtime(
        active=True,
        active_child=DowntimeChild(
            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=["*"],
            parent_id=123,
            recurrence=DowntimeRecurrence(
                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=["*"],
        parent_id=123,
        recurrence=DowntimeRecurrence(
            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,
    )  # Downtime | Update a downtime request body.

    # example passing only required values which don't have defaults set
    try:
        # Update a downtime
        api_response = api_instance.update_downtime(downtime_id, body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->update_downtime: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
downtime_id = 123456 # Integer | ID of the downtime to update.
body = DatadogAPIClient::V1::Downtime.new # Downtime | Update a downtime request body.

begin
  # Update a downtime
  result = api_instance.update_downtime(downtime_id, body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->update_downtime: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiUpdateDowntimeRequest = {
  // number | ID of the downtime to update.
  downtimeId: 123456,
  // Downtime | Update a downtime request body.
  body: {
    disabled: false,
    end: 1412793983,
    message: "Message on the downtime",
    monitorId: 123456,
    monitorTags: ["*"],
    parentId: 123,
    recurrence: {
      period: 1,
      rrule: "FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1",
      type: "weeks",
      untilDate: 1447786293,
      untilOccurrences: 2,
      weekDays: ["Mon","Tue"],
    },
    scope: ["env:staging"],
    start: 1412792983,
    timezone: "America/New_York",
  },
};

apiInstance.updateDowntime(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Long downtimeId = 123456L; // Long | ID of the downtime to update.
        Downtime body = new Downtime(); // Downtime | Update a downtime request body.
        try {
            Downtime result = apiInstance.updateDowntime(downtimeId, body);
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

GET https://api.datadoghq.eu/api/v1/monitor/{monitor_id}/downtimeshttps://api.ddog-gov.com/api/v1/monitor/{monitor_id}/downtimeshttps://api.datadoghq.com/api/v1/monitor/{monitor_id}/downtimeshttps://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}/downtimes

Présentation

Récupérez tous les downtimes du monitor spécifié.

Arguments

Paramètres du chemin

Nom

Type

Description

monitor_id [required]

integer

The id of the monitor

Réponse

OK

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:postgres AND team:frontend.

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. 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:dev AND env: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:postgres AND team:frontend.

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. 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:dev AND env: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": [
      "*"
    ],
    "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": [
    "*"
  ],
  "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
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Monitor Not Found error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export monitor_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/monitor/${monitor_id}/downtimes" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    monitorId := int64(789) // int64 | The id of the monitor

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.DowntimesApi.ListMonitorDowntimes(ctx, monitorId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DowntimesApi.ListMonitorDowntimes`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListMonitorDowntimes`: []Downtime
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from DowntimesApi.ListMonitorDowntimes:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = downtimes_api.DowntimesApi(api_client)
    monitor_id = 1  # int | The id of the monitor

    # example passing only required values which don't have defaults set
    try:
        # Get all downtimes for a monitor
        api_response = api_instance.list_monitor_downtimes(monitor_id)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DowntimesApi->list_monitor_downtimes: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::DowntimesAPI.new
monitor_id = 789 # Integer | The id of the monitor

begin
  # Get all downtimes for a monitor
  result = api_instance.list_monitor_downtimes(monitor_id)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling DowntimesAPI->list_monitor_downtimes: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.DowntimesApi(configuration);

let params:v1.DowntimesApiListMonitorDowntimesRequest = {
  // number | The id of the monitor
  monitorId: 1,
};

apiInstance.listMonitorDowntimes(params).then((data:any) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}).catch((error:any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DowntimesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        DowntimesApi apiInstance = new DowntimesApi(defaultClient);
        Long monitorId = 56L; // Long | The id of the monitor
        try {
            List<Downtime> result = apiInstance.listMonitorDowntimes(monitorId);
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"