モニター

モニター

モニターを使用すると、気になるメトリクスまたはチェックを監視して、定義されたしきい値を超えたときにチームに通知することができます。 詳しくは、モニターの作成ページを参照してください。

POST https://api.datadoghq.eu/v1/monitor/unmute_allhttps://api.ddog-gov.com/v1/monitor/unmute_allhttps://api.datadoghq.com/v1/monitor/unmute_allhttps://api.us3.datadoghq.com/v1/monitor/unmute_all

概要

すべてのモニターのミュートを無効にします。ミュートがすべて 有効になっていなかった場合は、エラーを生成します。

応答

OK

Bad Request

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


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

POST https://api.datadoghq.eu/api/v1/monitor/{monitor_id}/mutehttps://api.ddog-gov.com/api/v1/monitor/{monitor_id}/mutehttps://api.datadoghq.com/api/v1/monitor/{monitor_id}/mutehttps://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}/mute

概要

指定されたモニターをミュートします。

引数

パスパラメーター

名前

種類

説明

monitor_id [required]

integer

The id of the monitor

クエリ文字列

名前

種類

説明

scope

string

The scope to apply the mute to. For example, if your alert is grouped by {host}, you might mute host:app1.

end

integer

A POSIX timestamp for when the mute should end.

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Monitor Not Found error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# Path parameters
export monitor_id="CHANGE_ME"
# 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/monitor/${monitor_id}/mute" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

from datadog import initialize, api

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

initialize(**options)

# Mute a monitor
api.Monitor.mute(2088)

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)

# Mute a monitor
dog.mute_monitor(62_628)

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/v1/monitor/mute_allhttps://api.ddog-gov.com/v1/monitor/mute_allhttps://api.datadoghq.com/v1/monitor/mute_allhttps://api.us3.datadoghq.com/v1/monitor/mute_all

概要

ミュートすると、すべてのモニターが電子メールによる通知とイベントストリームへのポストを停止します。 アラートページをチェックしないと、状態変更は表示されません。

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


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

POST https://api.datadoghq.eu/api/v1/monitor/{monitor_id}/unmutehttps://api.ddog-gov.com/api/v1/monitor/{monitor_id}/unmutehttps://api.datadoghq.com/api/v1/monitor/{monitor_id}/unmutehttps://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}/unmute

概要

指定されたモニターのミュートを解除します。

引数

パスパラメーター

名前

種類

説明

monitor_id [required]

integer

The id of the monitor

クエリ文字列

名前

種類

説明

scope

string

The scope to apply the mute to. For example, if your alert is grouped by {host}, you might mute host:app1.

all_scopes

boolean

Clear muting across all scopes. Default is false.

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Monitor Not Found error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# Path parameters
export monitor_id="CHANGE_ME"
# 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/monitor/${monitor_id}/unmute" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
from datadog import initialize, api

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

initialize(**options)

# Unmute all alerts
api.Monitor.unmute(2088)

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)

# Unmute an alert
dog.unmute_monitor(62_628)

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/monitorhttps://api.ddog-gov.com/api/v1/monitorhttps://api.datadoghq.com/api/v1/monitorhttps://api.us3.datadoghq.com/api/v1/monitor

概要

指定されたオプションを使用してモニターを作成します。

モニターの種類

選択可能なモニターの種類:

  • 異常検知: query alert
  • APM: query alert または trace-analytics alert
  • 複合条件: composite
  • カスタム: service check
  • イベント: event alert
  • 予測値: query alert
  • ホスト: service check
  • インテグレーション: query alert または service check
  • ライブプロセス: process alert
  • ログ: log alert
  • メトリクス: metric alert
  • ネットワーク: service check
  • 外れ値: query alert
  • プロセス: service check
  • RUM: rum alert
  • SLO: slo alert
  • Watchdog: event alert
  • event-v2: event-v2 alert

クエリの種類

メトリクスアラートのクエリ

例: time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator #

  • time_aggr: avg、sum、max、min、change、pct_change
  • time_window: last_#m (# = モニターの種類に応じて 1〜2880) またはlast_#h(# = モニターの種類に応じて 1〜48)、last_1d
  • space_aggr: avg、sum、min、max
  • tags: 1つ以上のタグ (カンマ区切り)、または *
  • key: key:value タグ構文内の ‘key’。グループ内のタグごとに異なるアラートを定義します(マルチアラート)
  • operator: <、<=、>、>=、==、!=
  • #: しきい値の設定に使用される整数または小数

_change_ または _pct_change_ 時間集計関数を使用する場合は、代わりに change_aggr(time_aggr(time_window), timeshift):space_aggr:metric{tags} [by {key}] operator # を次のように使用します。

  • change_aggr change, pct_change
  • time_aggr avg, sum, max, min 詳細はこちら
  • time_window last_#m (モニターの種類に応じて 1〜2880), last_#h (モニターの種類に応じて 1〜48), last_#d (1 または 2)
  • timeshift #m_ago (5、10、15、30), #h_ago (1、2、4)、1d_ago

次のクエリを使用して、外れ値モニターを作成できます: avg(last_30m):outliers(avg:system.cpu.user{role:es-events-data} by {host}, 'dbscan', 7) > 0

サービスチェックのクエリ

例: "check".over(tags).last(count).by(group).count_by_status()

  • check チェックの名前。例. datadog.agent.up
  • tags 引用符で囲まれた 1 つ以上のタグ (カンマ区切り)、または “*"。例: .over("env:prod", "role:db")over は空白にはできません。
  • count 最大しきい値 (options で定義) 以上である必要があります。上限値は 100 です。 例: ステータス 1 を critical、3 を OK、2 を warn と通知する場合は、count を最低 3 にする必要があります。
  • チェックモニターに対して group を指定する必要があります。いくつかのサービスチェックでは、チェック別のグルーピングが既に明示されています。 例えば、Postgres インテグレーションモニターは dbhostport で、ネットワークモニターは hostinstanceurl でタグ付けされます。詳しくはサービスチェックのドキュメントを参照してください。

イベントアラートのクエリ

例: events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"

  • event, イベントクエリの文字列。
  • string_query イベントのタイトルとテキストと照合するフリーテキストクエリ。
  • sources イベントのソース (カンマ区切り)。
  • status イベントのステータス (カンマ区切り)。有効なオプション: error、warn、info。
  • priority イベントの優先度 (カンマ区切り)。有効なオプション: low、normal、all。
  • host イベントを報告しているホスト (カンマ区切り)。
  • tags イベントタグ (カンマ区切り)。
  • excluded_tags 除外されたイベントタグ (カンマ区切り)。
  • rollup 統計のロールアップ方法。現在 count のみサポートされています。
  • last カウントをロールアップするタイムフレーム。例: 45分、4時間。サポート対象のタイムフレーム: m、h、d。この値は 48 時間以内である必要があります。

US1 および EU でのみ利用できます。

イベント V2 アラートのクエリ

例: events(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 検索クエリ - ログ検索構文に従います。
  • rollup_method  統計のロールアップ方法。countavgcardinality に対応します。
  • measure avg および cardinality rollup_method で、使用する測定またはファセット名を指定します。
  • time_window #m (1 ~2880)、#h (1~48)。
  • operator <<=>>===!=
  • # しきい値の設定に使用される整数または小数。

US1-FED および US3 で利用できます。また、EU と US1 ではクローズドベータ版のみ利用できます。

プロセスアラートのクエリ

例: processes(search).over(tags).rollup('count').last(timeframe) operator #

  • search プロセスの問い合わせに使用するフリーテキスト検索文字列。 一致するプロセスは、ライブプロセス ページの結果と一致します。
  • tags 1 つ以上のタグ (カンマ区切り)
  • timeframe カウントをロールアップするタイムフレーム。例: 10分、4時間。サポート対象のタイムフレーム: s、m、h、d
  • operator <、<=、>、>=、==、!=
  • # しきい値の設定に使用される整数または小数

ログアラートのクエリ

例: logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 検索クエリ - ログ検索構文に従います。
  • index_name マルチインデックスのオーガニゼーションの場合に、リクエストが実行されるログインデックス。
  • rollup_method 統計のロールアップ方法。countavgcardinality に対応します。
  • measure avg および cardinality rollup_method で、使用する測定またはファセット名を指定します。
  • time_window #m (1〜2880)、#h (1〜48)
  • operator <<=>>===!=
  • # しきい値の設定に使用される整数または小数。

複合条件のクエリ

例: 12345 && 67890。ここで、1234567890 は非複合条件モニターの ID です。

  • name [required, default = dynamic, based on query]: アラートの名前。
  • message [required, default = dynamic, based on query]: このモニターの通知に含めるメッセージ。 イベントと同じ「@username」表記を使用して、特定のユーザーに電子メール通知を送信できます。
  • tags [optional, default = empty list]: モニターに関連付けられるタグのリスト。 API からすべてのモニター詳細を取得する際は、monitor_tags 引数を使用して、これらのタグで結果を絞り込みます。 API からのみ使用でき、Datadog UI での表示や編集はできません。

SLO アラートクエリ

例: error_budget("slo_id").over("time_window") operator #

  • slo_id: アラートを構成する SLO の SLO ID(英数字)。
  • time_window: アラートの対象とする SLO ターゲットのタイムウィンドウ。有効なオプション: 7d30d90d
  • operator: >= or >

リクエスト

Body Data (required)

モニターのリクエスト本文を作成します。

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "message": "string",
  "name": "string",
  "options": {
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "tags": [],
  "type": "metric alert"
}

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


## json-request-body
# 
# 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/monitor" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "message": "You may need to add web hosts if this is consistently high.",
  "name": "Bytes received on host0",
  "options": {
    "no_data_timeframe": 20,
    "notify_no_data": true
  },
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} \u003e 100",
  "tags": [
    "app:webserver",
    "frontend"
  ],
  "type": "metric alert"
}
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.NewMonitor("avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", datadog.MonitorType("composite")) // Monitor | Create a monitor request body.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.CreateMonitor(ctx, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.CreateMonitor`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateMonitor`: Monitor
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.CreateMonitor:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    body = Monitor(
        message="message_example",
        name="name_example",
        options=MonitorOptions(
            enable_logs_sample=True,
            escalation_message="none",
            evaluation_delay=1,
            groupby_simple_monitor=True,
            include_tags=True,
            locked=True,
            min_failure_duration=0,
            min_location_failed=1,
            new_group_delay=1,
            new_host_delay=300,
            no_data_timeframe=1,
            notify_audit=False,
            notify_no_data=False,
            renotify_interval=1,
            require_full_window=True,
            silenced={
                "key": 1,
            },
            synthetics_check_id="synthetics_check_id_example",
            threshold_windows=MonitorThresholdWindowOptions(
                recovery_window="recovery_window_example",
                trigger_window="trigger_window_example",
            ),
            thresholds=MonitorThresholds(
                critical=3.14,
                critical_recovery=3.14,
                ok=3.14,
                unknown=3.14,
                warning=3.14,
                warning_recovery=3.14,
            ),
            timeout_h=1,
        ),
        priority=1,
        query="avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
        restricted_roles=[
            "restricted_roles_example",
        ],
        tags=[
            "tags_example",
        ],
        type=MonitorType("metric alert"),
    )  # Monitor | Create a monitor request body.

    # example passing only required values which don't have defaults set
    try:
        # Create a monitor
        api_response = api_instance.create_monitor(body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->create_monitor: %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::MonitorsAPI.new
body = DatadogAPIClient::V1::Monitor.new({query: 'avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100', type: DatadogAPIClient::V1::MonitorType::COMPOSITE}) # Monitor | Create a monitor request body.

begin
  # Create a monitor
  result = api_instance.create_monitor(body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->create_monitor: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiCreateMonitorRequest = {
  // Monitor | Create a monitor request body.
  body: {
    message: "message_example",
    name: "name_example",
    options: {
      enableLogsSample: true,
      escalationMessage: "none",
      evaluationDelay: 1,
      groupbySimpleMonitor: true,
      includeTags: true,
      locked: true,
      minFailureDuration: 0,
      minLocationFailed: 1,
      newGroupDelay: 1,
      newHostDelay: 300,
      noDataTimeframe: 1,
      notifyAudit: false,
      notifyNoData: false,
      renotifyInterval: 1,
      requireFullWindow: true,
      silenced: {
        key: 1,
      },
      syntheticsCheckId: "syntheticsCheckId_example",
      thresholdWindows: {
        recoveryWindow: "recoveryWindow_example",
        triggerWindow: "triggerWindow_example",
      },
      thresholds: {
        critical: 3.14,
        criticalRecovery: 3.14,
        ok: 3.14,
        unknown: 3.14,
        warning: 3.14,
        warningRecovery: 3.14,
      },
      timeoutH: 1,
    },
    priority: 1,
    query: "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
    restrictedRoles: ["restrictedRoles_example"],
    tags: ["tags_example"],
    type: "metric alert",
  },
};

apiInstance
  .createMonitor(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        Monitor body = new Monitor(); // Monitor | Create a monitor request body.
        try {
            Monitor result = apiInstance.createMonitor(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#createMonitor");
            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)

# Create a new monitor
monitor_options = {
    "notify_no_data": True,
    "no_data_timeframe": 20
}
tags = ["app:webserver", "frontend"]
api.Monitor.create(
    type="metric alert",
    query="avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
    name="Bytes received on host0",
    message="We may need to add web hosts if this is consistently high.",
    tags=tags,
    options=monitor_options
)

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)

# Create a new monitor
options = {
  'notify_no_data' => true,
  'no_data_timeframe' => 20
}
tags = ['app:webserver', 'frontend']
dog.monitor(
  'metric alert',
  'avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100',
  name: 'Bytes received on host0',
  message: 'We may need to add web hosts if this is consistently high.',
  tags: tags,
  options: options
)

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"

GET https://api.datadoghq.eu/api/v1/monitor/searchhttps://api.ddog-gov.com/api/v1/monitor/searchhttps://api.datadoghq.com/api/v1/monitor/searchhttps://api.us3.datadoghq.com/api/v1/monitor/search

概要

モニターの詳細を検索および絞り込みをします。

引数

クエリ文字列

名前

種類

説明

query

string

After entering a search query in your Manage Monitor page use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated manage monitor documentation page to learn more.

The query can contain any number of space-separated monitor attributes, for instance query="type:metric status:alert".

page

integer

Page to start paginating from.

per_page

integer

Number of monitors to return per page.

sort

string

String for sort order, composed of field and sort order separate by a comma, e.g. name,asc. Supported sort directions: asc, desc. Supported fields:

  • name
  • status
  • tags

応答

OK

The response form a monitor search.

Expand All

フィールド

種類

説明

counts

object

The counts of monitors per different criteria.

muted

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

status

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

tag

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

type

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

metadata

object

Metadata about the response.

page

int64

The page to start paginating from.

page_count

int64

The number of pages.

per_page

int64

The number of monitors to return per page.

total_count

int64

The total number of monitors.

monitors

[object]

The list of found monitors.

classification

string

Classification of the monitor.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

id

int64

ID of the monitor.

last_triggered_ts

int64

Latest timestamp the monitor triggered.

metrics

[string]

Metrics used by the monitor.

name

string

The monitor name.

notifications

[object]

The notification triggered by the monitor.

handle

string

The email address that received the notification.

name

string

The username receiving the notification

org_id

int64

The ID of the organization.

scopes

[string]

The scope(s) to which the downtime applies, e.g. host:app2. Provide multiple scopes as a comma-separated list, e.g. env:dev,env:prod. The resulting downtime applies to sources that matches ALL provided scopes (i.e. env:dev AND env:prod), NOT any of them.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated with the monitor.

type

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "counts": {
    "muted": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ],
    "status": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ],
    "tag": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ],
    "type": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ]
  },
  "metadata": {
    "page": "integer",
    "page_count": "integer",
    "per_page": "integer",
    "total_count": "integer"
  },
  "monitors": [
    {
      "classification": "string",
      "creator": {
        "email": "string",
        "handle": "string",
        "name": "string"
      },
      "id": "integer",
      "last_triggered_ts": "integer",
      "metrics": [],
      "name": "string",
      "notifications": [
        {
          "handle": "string",
          "name": "string"
        }
      ],
      "org_id": "integer",
      "scopes": [
        "host:app2",
        "env:dev,env:prod"
      ],
      "status": "string",
      "tags": [],
      "type": "metric alert"
    }
  ]
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# 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/search" \
-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())

    query := "query_example" // string | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
    page := int64(789) // int64 | Page to start paginating from. (optional) (default to 0)
    perPage := int64(789) // int64 | Number of monitors to return per page. (optional) (default to 30)
    sort := "sort_example" // string | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)
    optionalParams := datadog.SearchMonitorsOptionalParameters{
        Query: &query,
        Page: &page,
        PerPage: &perPage,
        Sort: &sort,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.SearchMonitors(ctx, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.SearchMonitors`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `SearchMonitors`: MonitorSearchResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.SearchMonitors:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    query = "query_example"  # str | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
    page = 0  # int | Page to start paginating from. (optional) if omitted the server will use the default value of 0
    per_page = 30  # int | Number of monitors to return per page. (optional) if omitted the server will use the default value of 30
    sort = "sort_example"  # str | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Monitors search
        api_response = api_instance.search_monitors(query=query, page=page, per_page=per_page, sort=sort)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->search_monitors: %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::MonitorsAPI.new
opts = {
  query: 'query_example', # String | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors
  page: 789, # Integer | Page to start paginating from.
  per_page: 789, # Integer | Number of monitors to return per page.
  sort: 'sort_example' # String | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags`
}

begin
  # Monitors search
  result = api_instance.search_monitors(opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->search_monitors: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiSearchMonitorsRequest = {
  // string | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
  query: "query_example",
  // number | Page to start paginating from. (optional)
  page: 0,
  // number | Number of monitors to return per page. (optional)
  perPage: 30,
  // string | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)
  sort: "sort_example",
};

apiInstance
  .searchMonitors(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        String query = "query_example"; // String | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors
        Long page = 0L; // Long | Page to start paginating from.
        Long perPage = 30L; // Long | Number of monitors to return per page.
        String sort = "sort_example"; // String | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags`
        try {
            MonitorSearchResponse result = apiInstance.searchMonitors(new MonitorsApi.SearchMonitorsOptionalParameters()
                .query(query)
                .page(page)
                .perPage(perPage)
                .sort(sort));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#searchMonitors");
            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)

# Search monitors
api.Monitor.search()

# Examples of possible query parameters:
# api.Monitor.search(query="id:7100311")
# api.Monitor.search(query="title:foo metric:system.core.idle status:Alert")

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)

# Search monitors
dog.search_monitors

# Examples of possible query parameters:
# dog.search_monitors(query="id:7100311")
# dog.search_monitors(query="title:foo metric:system.core.idle status:Alert")

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"

GET https://api.datadoghq.eu/api/v1/monitorhttps://api.ddog-gov.com/api/v1/monitorhttps://api.datadoghq.com/api/v1/monitorhttps://api.us3.datadoghq.com/api/v1/monitor

概要

オーガニゼーションから指定されたモニターに関する詳細を取得します。

引数

クエリ文字列

名前

種類

説明

group_states

string

When specified, shows additional information about the group states. Choose one or more from all, alert, warn, and no data.

name

string

A string to filter monitors by name.

tags

string

A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, host:host0.

monitor_tags

string

A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, service:my-app.

with_downtimes

boolean

If this argument is set to true, then the returned data includes all current active downtimes for each monitor.

id_offset

integer

Monitor ID offset.

page

integer

The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination.

page_size

integer

The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a page_size limit. However, if page is specified and page_size is not, the argument defaults to 100.

応答

OK

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# 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" \
-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())

    groupStates := "alert" // string | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)
    name := "name_example" // string | A string to filter monitors by name. (optional)
    tags := "host:host0" // string | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, `host:host0`. (optional)
    monitorTags := "service:my-app" // string | A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, `service:my-app`. (optional)
    withDowntimes := true // bool | If this argument is set to true, then the returned data includes all current active downtimes for each monitor. (optional)
    idOffset := int64(789) // int64 | Monitor ID offset. (optional)
    page := int64(0) // int64 | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination. (optional)
    pageSize := int32(20) // int32 | The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a `page_size` limit. However, if page is specified and `page_size` is not, the argument defaults to 100. (optional)
    optionalParams := datadog.ListMonitorsOptionalParameters{
        GroupStates: &groupStates,
        Name: &name,
        Tags: &tags,
        MonitorTags: &monitorTags,
        WithDowntimes: &withDowntimes,
        IdOffset: &idOffset,
        Page: &page,
        PageSize: &pageSize,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.ListMonitors(ctx, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.ListMonitors`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListMonitors`: []Monitor
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.ListMonitors:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    group_states = "alert"  # str | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)
    name = "name_example"  # str | A string to filter monitors by name. (optional)
    tags = "host:host0"  # str | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, `host:host0`. (optional)
    monitor_tags = "service:my-app"  # str | A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, `service:my-app`. (optional)
    with_downtimes = True  # bool | If this argument is set to true, then the returned data includes all current active downtimes for each monitor. (optional)
    id_offset = 1  # int | Monitor ID offset. (optional)
    page = 0  # int | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination. (optional)
    page_size = 20  # int | The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a `page_size` limit. However, if page is specified and `page_size` is not, the argument defaults to 100. (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get all monitor details
        api_response = api_instance.list_monitors(group_states=group_states, name=name, tags=tags, monitor_tags=monitor_tags, with_downtimes=with_downtimes, id_offset=id_offset, page=page, page_size=page_size)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->list_monitors: %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::MonitorsAPI.new
opts = {
  group_states: 'alert', # String | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`.
  name: 'name_example', # String | A string to filter monitors by name.
  tags: 'host:host0', # String | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, `host:host0`.
  monitor_tags: 'service:my-app', # String | A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, `service:my-app`.
  with_downtimes: true, # Boolean | If this argument is set to true, then the returned data includes all current active downtimes for each monitor.
  id_offset: 789, # Integer | Monitor ID offset.
  page: 0, # Integer | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination.
  page_size: 20 # Integer | The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a `page_size` limit. However, if page is specified and `page_size` is not, the argument defaults to 100.
}

begin
  # Get all monitor details
  result = api_instance.list_monitors(opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->list_monitors: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiListMonitorsRequest = {
  // string | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)
  groupStates: "alert",
  // string | A string to filter monitors by name. (optional)
  name: "name_example",
  // string | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, `host:host0`. (optional)
  tags: "host:host0",
  // string | A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, `service:my-app`. (optional)
  monitorTags: "service:my-app",
  // boolean | If this argument is set to true, then the returned data includes all current active downtimes for each monitor. (optional)
  withDowntimes: true,
  // number | Monitor ID offset. (optional)
  idOffset: 1,
  // number | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination. (optional)
  page: 0,
  // number | The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a `page_size` limit. However, if page is specified and `page_size` is not, the argument defaults to 100. (optional)
  pageSize: 20,
};

apiInstance
  .listMonitors(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        String groupStates = "alert"; // String | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`.
        String name = "name_example"; // String | A string to filter monitors by name.
        String tags = "host:host0"; // String | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. For example, `host:host0`.
        String monitorTags = "service:my-app"; // String | A comma separated list indicating what service and/or custom tags, if any, should be used to filter the list of monitors. Tags created in the Datadog UI automatically have the service key prepended. For example, `service:my-app`.
        Boolean withDowntimes = true; // Boolean | If this argument is set to true, then the returned data includes all current active downtimes for each monitor.
        Long idOffset = 56L; // Long | Monitor ID offset.
        Long page = 0L; // Long | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination.
        Integer pageSize = 20; // Integer | The number of monitors to return per page. If the page argument is not specified, the default behavior returns all monitors without a `page_size` limit. However, if page is specified and `page_size` is not, the argument defaults to 100.
        try {
            List<Monitor> result = apiInstance.listMonitors(new MonitorsApi.ListMonitorsOptionalParameters()
                .groupStates(groupStates)
                .name(name)
                .tags(tags)
                .monitorTags(monitorTags)
                .withDowntimes(withDowntimes)
                .idOffset(idOffset)
                .page(page)
                .pageSize(pageSize));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#listMonitors");
            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 monitor details
print(api.Monitor.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 monitor details
dog.get_all_monitors

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"

GET https://api.datadoghq.eu/api/v1/monitor/groups/searchhttps://api.ddog-gov.com/api/v1/monitor/groups/searchhttps://api.datadoghq.com/api/v1/monitor/groups/searchhttps://api.us3.datadoghq.com/api/v1/monitor/groups/search

概要

モニターグループの詳細を検索および絞り込みをします。

引数

クエリ文字列

名前

種類

説明

query

string

After entering a search query in your Manage Monitor page use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated manage monitor documentation page to learn more.

The query can contain any number of space-separated monitor attributes, for instance query="type:metric status:alert".

page

integer

Page to start paginating from.

per_page

integer

Number of monitors to return per page.

sort

string

String for sort order, composed of field and sort order separate by a comma, e.g. name,asc. Supported sort directions: asc, desc. Supported fields:

  • name
  • status
  • tags

応答

OK

The response of a monitor group search.

Expand All

フィールド

種類

説明

counts

object

The counts of monitor groups per different criteria.

status

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

type

[object]

Search facets.

count

int64

The number of found monitors with the listed value.

name

The facet value.

groups

[object]

The list of found monitor groups.

group

string

The name of the group.

group_tags

[string]

The list of tags of the monitor group.

last_nodata_ts

int64

Latest timestamp the monitor group was in NO_DATA state.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

monitor_id

int64

The ID of the monitor.

monitor_name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

metadata

object

Metadata about the response.

page

int64

The page to start paginating from.

page_count

int64

The number of pages.

per_page

int64

The number of monitors to return per page.

total_count

int64

The total number of monitors.

{
  "counts": {
    "status": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ],
    "type": [
      {
        "count": "integer",
        "name": "undefined"
      }
    ]
  },
  "groups": [
    {
      "group": "string",
      "group_tags": [],
      "last_nodata_ts": "integer",
      "last_triggered_ts": "integer",
      "monitor_id": "integer",
      "monitor_name": "string",
      "status": "string"
    }
  ],
  "metadata": {
    "page": "integer",
    "page_count": "integer",
    "per_page": "integer",
    "total_count": "integer"
  }
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# 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/groups/search" \
-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())

    query := "query_example" // string | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
    page := int64(789) // int64 | Page to start paginating from. (optional) (default to 0)
    perPage := int64(789) // int64 | Number of monitors to return per page. (optional) (default to 30)
    sort := "sort_example" // string | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)
    optionalParams := datadog.SearchMonitorGroupsOptionalParameters{
        Query: &query,
        Page: &page,
        PerPage: &perPage,
        Sort: &sort,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.SearchMonitorGroups(ctx, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.SearchMonitorGroups`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `SearchMonitorGroups`: MonitorGroupSearchResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.SearchMonitorGroups:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    query = "query_example"  # str | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
    page = 0  # int | Page to start paginating from. (optional) if omitted the server will use the default value of 0
    per_page = 30  # int | Number of monitors to return per page. (optional) if omitted the server will use the default value of 30
    sort = "sort_example"  # str | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Monitors group search
        api_response = api_instance.search_monitor_groups(query=query, page=page, per_page=per_page, sort=sort)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->search_monitor_groups: %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::MonitorsAPI.new
opts = {
  query: 'query_example', # String | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors
  page: 789, # Integer | Page to start paginating from.
  per_page: 789, # Integer | Number of monitors to return per page.
  sort: 'sort_example' # String | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags`
}

begin
  # Monitors group search
  result = api_instance.search_monitor_groups(opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->search_monitor_groups: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiSearchMonitorGroupsRequest = {
  // string | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors (optional)
  query: "query_example",
  // number | Page to start paginating from. (optional)
  page: 0,
  // number | Number of monitors to return per page. (optional)
  perPage: 30,
  // string | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags` (optional)
  sort: "sort_example",
};

apiInstance
  .searchMonitorGroups(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        String query = "query_example"; // String | After entering a search query in your [Manage Monitor page][1] use the query parameter value in the URL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2] page to learn more.  The query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.  [1]: https://app.datadoghq.com/monitors/manage [2]: /monitors/manage_monitor/#find-the-monitors
        Long page = 0L; // Long | Page to start paginating from.
        Long perPage = 30L; // Long | Number of monitors to return per page.
        String sort = "sort_example"; // String | String for sort order, composed of field and sort order separate by a comma, e.g. `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:  * `name` * `status` * `tags`
        try {
            MonitorGroupSearchResponse result = apiInstance.searchMonitorGroups(new MonitorsApi.SearchMonitorGroupsOptionalParameters()
                .query(query)
                .page(page)
                .perPage(perPage)
                .sort(sort));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#searchMonitorGroups");
            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)

# Search monitor groups
api.Monitor.search_groups()

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)

# Search monitor groups
dog.search_monitor_groups

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/monitor/{monitor_id}https://api.ddog-gov.com/api/v1/monitor/{monitor_id}https://api.datadoghq.com/api/v1/monitor/{monitor_id}https://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}

概要

指定されたモニターを編集します。

引数

パスパラメーター

名前

種類

説明

monitor_id [required]

integer

The ID of the monitor.

リクエスト

Body Data (required)

モニターのリクエスト本文を編集します。

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "message": "string",
  "name": "string",
  "options": {
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "priority": "integer",
  "query": "string",
  "restricted_roles": [],
  "tags": [],
  "type": "metric alert"
}

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Monitor Not Found error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# Path parameters
export monitor_id="CHANGE_ME"
# 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/monitor/${monitor_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())

    monitorId := int64(789) // int64 | The ID of the monitor.
    body := *datadog.NewMonitorUpdateRequest() // MonitorUpdateRequest | Edit a monitor request body.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.UpdateMonitor(ctx, monitorId, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.UpdateMonitor`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateMonitor`: Monitor
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.UpdateMonitor:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    monitor_id = 1  # int | The ID of the monitor.
    body = MonitorUpdateRequest(
        message="message_example",
        name="name_example",
        options=MonitorOptions(
            enable_logs_sample=True,
            escalation_message="none",
            evaluation_delay=1,
            groupby_simple_monitor=True,
            include_tags=True,
            locked=True,
            min_failure_duration=0,
            min_location_failed=1,
            new_group_delay=1,
            new_host_delay=300,
            no_data_timeframe=1,
            notify_audit=False,
            notify_no_data=False,
            renotify_interval=1,
            require_full_window=True,
            silenced={
                "key": 1,
            },
            synthetics_check_id="synthetics_check_id_example",
            threshold_windows=MonitorThresholdWindowOptions(
                recovery_window="recovery_window_example",
                trigger_window="trigger_window_example",
            ),
            thresholds=MonitorThresholds(
                critical=3.14,
                critical_recovery=3.14,
                ok=3.14,
                unknown=3.14,
                warning=3.14,
                warning_recovery=3.14,
            ),
            timeout_h=1,
        ),
        priority=1,
        query="query_example",
        restricted_roles=[
            "restricted_roles_example",
        ],
        tags=[
            "tags_example",
        ],
        type=MonitorType("metric alert"),
    )  # MonitorUpdateRequest | Edit a monitor request body.

    # example passing only required values which don't have defaults set
    try:
        # Edit a monitor
        api_response = api_instance.update_monitor(monitor_id, body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->update_monitor: %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::MonitorsAPI.new
monitor_id = 789 # Integer | The ID of the monitor.
body = DatadogAPIClient::V1::MonitorUpdateRequest.new # MonitorUpdateRequest | Edit a monitor request body.

begin
  # Edit a monitor
  result = api_instance.update_monitor(monitor_id, body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->update_monitor: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiUpdateMonitorRequest = {
  // number | The ID of the monitor.
  monitorId: 1,
  // MonitorUpdateRequest | Edit a monitor request body.
  body: {
    message: "message_example",
    name: "name_example",
    options: {
      enableLogsSample: true,
      escalationMessage: "none",
      evaluationDelay: 1,
      groupbySimpleMonitor: true,
      includeTags: true,
      locked: true,
      minFailureDuration: 0,
      minLocationFailed: 1,
      newGroupDelay: 1,
      newHostDelay: 300,
      noDataTimeframe: 1,
      notifyAudit: false,
      notifyNoData: false,
      renotifyInterval: 1,
      requireFullWindow: true,
      silenced: {
        key: 1,
      },
      syntheticsCheckId: "syntheticsCheckId_example",
      thresholdWindows: {
        recoveryWindow: "recoveryWindow_example",
        triggerWindow: "triggerWindow_example",
      },
      thresholds: {
        critical: 3.14,
        criticalRecovery: 3.14,
        ok: 3.14,
        unknown: 3.14,
        warning: 3.14,
        warningRecovery: 3.14,
      },
      timeoutH: 1,
    },
    priority: 1,
    query: "query_example",
    restrictedRoles: ["restrictedRoles_example"],
    tags: ["tags_example"],
    type: "metric alert",
  },
};

apiInstance
  .updateMonitor(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        Long monitorId = 56L; // Long | The ID of the monitor.
        MonitorUpdateRequest body = new MonitorUpdateRequest(); // MonitorUpdateRequest | Edit a monitor request body.
        try {
            Monitor result = apiInstance.updateMonitor(monitorId, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#updateMonitor");
            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}https://api.ddog-gov.com/api/v1/monitor/{monitor_id}https://api.datadoghq.com/api/v1/monitor/{monitor_id}https://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}

概要

オーガニゼーションから指定されたモニターに関する詳細を取得します。

引数

パスパラメーター

名前

種類

説明

monitor_id [required]

integer

The ID of the monitor

クエリ文字列

名前

種類

説明

group_states

string

When specified, shows additional information about the group states. Choose one or more from all, alert, warn, and no data.

応答

OK

Object describing a monitor.

Expand All

フィールド

種類

説明

created

date-time

Timestamp of the monitor creation.

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

deleted

date-time

Whether or not the monitor is deleted. (Always null)

id

int64

ID of this monitor.

message

string

A message to include with notifications for this monitor.

modified

date-time

Last timestamp when the monitor was edited.

multi

boolean

Whether or not the monitor is broken down on different groups.

name

string

The monitor name.

options

object

List of options associated with your monitor.

aggregation

object

Type of aggregation performed in the monitor query.

group_by

string

Group to break down the monitor on.

metric

string

Metric name used in the monitor.

type [required]

string

Metric type used in the monitor.

device_ids

[string]

DEPRECATED: IDs of the device the Synthetics monitor is running on.

enable_logs_sample

boolean

Whether or not to send a log sample when the log monitor triggers.

escalation_message

string

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.

evaluation_delay

int64

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.

groupby_simple_monitor

boolean

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.

include_tags

boolean

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title

locked

boolean

Whether or not the monitor is locked (only editable by creator and admins).

min_failure_duration

int64

How long the test should be in failure before alerting (integer, number of seconds, max 7200).

min_location_failed

int64

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).

new_group_delay

int64

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.

new_host_delay

int64

DEPRECATED: Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.

no_data_timeframe

int64

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for metric alerts, and 24 hours is used for service checks.

notify_audit

boolean

A Boolean indicating whether tagged users is notified on changes to this monitor.

notify_no_data

boolean

A Boolean indicating whether this monitor notifies when data stops reporting.

renotify_interval

int64

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.

require_full_window

boolean

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false.

silenced

object

DEPRECATED: Information about the downtime applied to the monitor.

<any-key>

int64

ID of the downtime applied to the monitor.

synthetics_check_id

string

DEPRECATED: ID of the corresponding Synthetic check.

threshold_windows

object

Alerting time window options.

recovery_window

string

Describes how long an anomalous metric must be normal before the alert recovers.

trigger_window

string

Describes how long a metric must be anomalous before an alert triggers.

thresholds

object

List of the different monitor threshold available.

critical

double

The monitor CRITICAL threshold.

critical_recovery

double

The monitor CRITICAL recovery threshold.

ok

double

The monitor OK threshold.

unknown

double

The monitor UNKNOWN threshold.

warning

double

The monitor WARNING threshold.

warning_recovery

double

The monitor WARNING recovery threshold.

timeout_h

int64

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state.

overall_state

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

priority

int64

Integer from 1 (high) to 5 (low) indicating alert severity.

query [required]

string

The monitor query.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API. Cannot be used with locked option.

state

object

Wrapper object with the different monitor states.

groups

object

Dictionary where the keys are groups (comma separated lists of tags) and the values are the list of groups your monitor is broken down on.

<any-key>

object

Monitor state for a single group.

last_nodata_ts

int64

Latest timestamp the monitor was in NO_DATA state.

last_notified_ts

int64

Latest timestamp of the notification sent for this monitor group.

last_resolved_ts

int64

Latest timestamp the monitor group was resolved.

last_triggered_ts

int64

Latest timestamp the monitor group triggered.

name

string

The name of the monitor.

status

enum

The different states your monitor can be in. Allowed enum values: Alert,Ignored,No Data,OK,Skipped,Unknown,Warn

tags

[string]

Tags associated to your monitor.

type [required]

enum

The type of the monitor. For more information about type, see the monitor options docs. Allowed enum values: composite,event alert,log alert,metric alert,process alert,query alert,rum alert,service check,synthetics alert,trace-analytics alert,slo alert,event-v2 alert,audit alert

{
  "created": "2019-09-19T10:00:00.000Z",
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "deleted": "2019-09-19T10:00:00.000Z",
  "id": "integer",
  "message": "string",
  "modified": "2019-09-19T10:00:00.000Z",
  "multi": false,
  "name": "string",
  "options": {
    "aggregation": {
      "group_by": "host",
      "metric": "metrics.name",
      "type": "count"
    },
    "device_ids": [],
    "enable_logs_sample": false,
    "escalation_message": "string",
    "evaluation_delay": "integer",
    "groupby_simple_monitor": false,
    "include_tags": false,
    "locked": false,
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "new_group_delay": "integer",
    "new_host_delay": "integer",
    "no_data_timeframe": "integer",
    "notify_audit": false,
    "notify_no_data": false,
    "renotify_interval": "integer",
    "require_full_window": false,
    "silenced": {
      "<any-key>": "integer"
    },
    "synthetics_check_id": "string",
    "threshold_windows": {
      "recovery_window": "string",
      "trigger_window": "string"
    },
    "thresholds": {
      "critical": "number",
      "critical_recovery": "number",
      "ok": "number",
      "unknown": "number",
      "warning": "number",
      "warning_recovery": "number"
    },
    "timeout_h": "integer"
  },
  "overall_state": "string",
  "priority": "integer",
  "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100",
  "restricted_roles": [],
  "state": {
    "groups": {
      "<any-key>": {
        "last_nodata_ts": "integer",
        "last_notified_ts": "integer",
        "last_resolved_ts": "integer",
        "last_triggered_ts": "integer",
        "name": "string",
        "status": "string"
      }
    }
  },
  "tags": [],
  "type": "metric alert"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Monitor Not Found error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# 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}" \ -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
    groupStates := "groupStates_example" // string | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)
    optionalParams := datadog.GetMonitorOptionalParameters{
        GroupStates: &groupStates,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.GetMonitor(ctx, monitorId, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.GetMonitor`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetMonitor`: Monitor
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.GetMonitor:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    monitor_id = 1  # int | The ID of the monitor
    group_states = "group_states_example"  # str | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)

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

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get a monitor's details
        api_response = api_instance.get_monitor(monitor_id, group_states=group_states)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->get_monitor: %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::MonitorsAPI.new
monitor_id = 789 # Integer | The ID of the monitor
opts = {
  group_states: 'group_states_example' # String | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`.
}

begin
  # Get a monitor's details
  result = api_instance.get_monitor(monitor_id, opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->get_monitor: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiGetMonitorRequest = {
  // number | The ID of the monitor
  monitorId: 1,
  // string | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. (optional)
  groupStates: "group_states_example",
};

apiInstance
  .getMonitor(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        Long monitorId = 56L; // Long | The ID of the monitor
        String groupStates = "groupStates_example"; // String | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`.
        try {
            Monitor result = apiInstance.getMonitor(monitorId, new MonitorsApi.GetMonitorOptionalParameters()
                .groupStates(groupStates));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#getMonitor");
            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 monitor's details
api.Monitor.get(2081, group_states='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 a monitors's details
dog.get_monitor(91_879, group_states: 'all')

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/monitor/{monitor_id}https://api.ddog-gov.com/api/v1/monitor/{monitor_id}https://api.datadoghq.com/api/v1/monitor/{monitor_id}https://api.us3.datadoghq.com/api/v1/monitor/{monitor_id}

概要

指定されたモニターを削除

引数

パスパラメーター

名前

種類

説明

monitor_id [required]

integer

The ID of the monitor.

クエリ文字列

名前

種類

説明

force

string

Delete the monitor even if it’s referenced by other resources (e.g. SLO, composite monitor).

応答

OK

Response from the delete monitor call.

Expand All

フィールド

種類

説明

deleted_monitor_id

int64

ID of the deleted monitor.

{
  "deleted_monitor_id": "integer"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item not found error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例


# Path parameters
export monitor_id="CHANGE_ME"
# 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/monitor/${monitor_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())

    monitorId := int64(789) // int64 | The ID of the monitor.
    force := "false" // string | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor). (optional)
    optionalParams := datadog.DeleteMonitorOptionalParameters{
        Force: &force,
    }

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.DeleteMonitor(ctx, monitorId, optionalParams)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.DeleteMonitor`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DeleteMonitor`: DeletedMonitor
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.DeleteMonitor:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    monitor_id = 1  # int | The ID of the monitor.
    force = "false"  # str | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor). (optional)

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

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Delete a monitor
        api_response = api_instance.delete_monitor(monitor_id, force=force)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->delete_monitor: %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::MonitorsAPI.new
monitor_id = 789 # Integer | The ID of the monitor.
opts = {
  force: 'false' # String | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor).
}

begin
  # Delete a monitor
  result = api_instance.delete_monitor(monitor_id, opts)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->delete_monitor: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiDeleteMonitorRequest = {
  // number | The ID of the monitor.
  monitorId: 1,
  // string | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor). (optional)
  force: "false",
};

apiInstance
  .deleteMonitor(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        Long monitorId = 56L; // Long | The ID of the monitor.
        String force = "false"; // String | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor).
        try {
            DeletedMonitor result = apiInstance.deleteMonitor(monitorId, new MonitorsApi.DeleteMonitorOptionalParameters()
                .force(force));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#deleteMonitor");
            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)

# Delete a monitor
api.Monitor.delete(2081)

# Force delete a monitor to override warnings
api.Monitor.delete(2081, force=True)

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)

# Delete a monitor
dog.delete_monitor(62_625)

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"

GET https://api.datadoghq.eu/api/v1/monitor/can_deletehttps://api.ddog-gov.com/api/v1/monitor/can_deletehttps://api.datadoghq.com/api/v1/monitor/can_deletehttps://api.us3.datadoghq.com/api/v1/monitor/can_delete

概要

特定のモニターが検知可能かどうかを確認します。

引数

クエリ文字列

名前

種類

説明

monitor_ids [required]

array

The IDs of the monitor to check.

応答

OK

Response of monitor IDs that can or can’t be safely deleted.

Expand All

フィールド

種類

説明

data [required]

object

Wrapper object with the list of monitor IDs.

ok

[integer]

An array of of Monitor IDs that can be safely deleted.

errors

object

A mapping of Monitor ID to strings denoting where it's used.

<any-key>

[string]

Strings denoting where a monitor is used.

{
  "data": {
    "ok": []
  },
  "errors": {
    "<any-key>": []
  }
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Deletion conflict error

Response of monitor IDs that can or can’t be safely deleted.

Expand All

フィールド

種類

説明

data [required]

object

Wrapper object with the list of monitor IDs.

ok

[integer]

An array of of Monitor IDs that can be safely deleted.

errors

object

A mapping of Monitor ID to strings denoting where it's used.

<any-key>

[string]

Strings denoting where a monitor is used.

{
  "data": {
    "ok": []
  },
  "errors": {
    "<any-key>": []
  }
}

コード例


# Required query arguments
export monitor_ids="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/can_delete?monitor_ids=${monitor_ids}" \ -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())

    monitorIds := []int64{int64(123)} // []int64 | The IDs of the monitor to check.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.MonitorsApi.CheckCanDeleteMonitor(ctx, monitorIds)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.CheckCanDeleteMonitor`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CheckCanDeleteMonitor`: CheckCanDeleteMonitorResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from MonitorsApi.CheckCanDeleteMonitor:\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 monitors_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 = monitors_api.MonitorsApi(api_client)
    monitor_ids = [
        1,
    ]  # [int] | The IDs of the monitor to check.

    # example passing only required values which don't have defaults set
    try:
        # Check if a monitor can be deleted
        api_response = api_instance.check_can_delete_monitor(monitor_ids)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MonitorsApi->check_can_delete_monitor: %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::MonitorsAPI.new
monitor_ids = [3.56] # Array<Integer> | The IDs of the monitor to check.

begin
  # Check if a monitor can be deleted
  result = api_instance.check_can_delete_monitor(monitor_ids)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling MonitorsAPI->check_can_delete_monitor: #{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.MonitorsApi(configuration);

let params: v1.MonitorsApiCheckCanDeleteMonitorRequest = {
  // Array<number> | The IDs of the monitor to check.
  monitorIds: [1],
};

apiInstance
  .checkCanDeleteMonitor(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.MonitorsApi;

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

        MonitorsApi apiInstance = new MonitorsApi(defaultClient);
        List<Long> monitorIds = Arrays.asList(); // List<Long> | The IDs of the monitor to check.
        try {
            CheckCanDeleteMonitorResponse result = apiInstance.checkCanDeleteMonitor(monitorIds);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MonitorsApi#checkCanDeleteMonitor");
            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)

# Check if you can delete the given monitors.
api.Monitor.can_delete(monitor_ids=[56838, 771060, 1000376])

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 'rubygems'
require 'dogapi'

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

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

# Check if you can delete the given monitors.
dog.can_delete_monitors([56838, 771060, 1000376])

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