For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/ko/api/latest/monitors/create-a-monitor.md. A documentation index is available at /llms.txt.
Language
Datadog site

모니터 생성하기

POSThttps://api.datadoghq.com/api/v1/monitorhttps://api.us3.datadoghq.com/api/v1/monitorhttps://api.us5.datadoghq.com/api/v1/monitorhttps://api.datadoghq.eu/api/v1/monitorhttps://api.ap1.datadoghq.com/api/v1/monitorhttps://api.ap2.datadoghq.com/api/v1/monitorhttps://api.uk1.datadoghq.com/api/v1/monitorhttps://api.ddog-gov.com/api/v1/monitorhttps://api.us2.ddog-gov.com/api/v1/monitor

개요

지정된 옵션을 사용하여 모니터를 생성합니다.

모니터 유형

다음 중에서 선택한 모니터 유형입니다.

  • anomaly: query alert
  • APM: query alert 또는 trace-analytics alert
  • composite: composite
  • custom: service check
  • forecast: query alert
  • host: service check
  • integration: query alert 또는 service check
  • live process: process alert
  • logs: log alert
  • metric: query alert
  • network: service check
  • outlier: query alert
  • process: service check
  • rum: rum alert
  • SLO: slo alert
  • watchdog: event-v2 alert
  • event-v2: event-v2 alert
  • audit: audit alert
  • error-tracking: error-tracking alert
  • database-monitoring: database-monitoring alert
  • network-performance: network-performance alert
  • cloud cost: cost alert
  • network-path: network-path alert

참고:

  • Synthetic 모니터는 Synthetics API를 통해 생성됩니다. 자세한 내용은 Synthetics API 설명서를 참조하세요.
  • 로그 모니터에는 범위가 지정되지 않은 App Key가 필요합니다.

쿼리 유형

메트릭 경보 쿼리

예: 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에서 10080 사이), last_#h(모니터 유형에 따라 #은 1에서 168 사이), last_1d 또는 last_1w
  • space_aggr: avg, sum, min 또는 max
  • tags: 하나 이상의 태그(쉼표로 구분) 또는 *
  • key: key:value 태그 구문의 'key', 그룹 내 각 태그에 대해 별도의 경보를 정의함(다중 경보)
  • operator: <, <=, >, >=, == 또는 !=
  • #: 임계값을 설정하는 데 사용되는 정수 또는 십진수

수식 쿼리가 있는 메트릭 모니터에서 동적 임계값을 사용하려면 #을 threshold 키워드 (예: ... > threshold)로 교체하고 options.thresholds의 critical_query를 통해 쿼리로 임계값을 제공하세요. 이 기능은 미리 보기로 제공되고 있습니다.

_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 하나 이상의 따옴표로 묶인 태그(쉼표로 구분), 또는 "*" (예: .over("env:prod", "role:db")), over는 비워둘 수 없습니다.
  • count는 최대 임계값(options에 정의됨)보다 크거나 같아야 합니다. 이 값은 100으로 제한됩니다. 예를 들어, 1개의 critical, 3개의 ok, 2개의 warn 상태를 지정한 경우 count는 최소 3이어야 합니다.
  • group은 검사 모니터에 대해 지정해야 합니다. 검사별 그룹화는 일부 서비스 검사에 대해 이미 명시적으로 알려져 있습니다. 예를 들어, Postgres 통합 모니터는 db, host, port로 태그가 지정되고, 네트워크 모니터는 host, instance, url로 태그가 지정됩니다. 자세한 내용은 서비스 검사 설명서를 참조하세요.
이벤트 경보 쿼리

참고: 이벤트 경보 쿼리는 이벤트 V2 경보 쿼리로 대체되었습니다. 자세한 내용은 이벤트 마이그레이션 가이드를 참조하세요.

이벤트 V2 경보 쿼리

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

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg 및 cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
프로세스 경보 쿼리

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

  • search 프로세스를 쿼리하기 위한 자유 텍스트 검색 문자열입니다. 일치하는 프로세스는 Live Processes 페이지의 결과와 일치합니다.
  • tags 하나 이상의 태그(쉼표로 구분)
  • timeframe 개수를 롤업할 타임프레임 (예: 10m, 4h) 지원되는 타임프레임: s, m, h, d
  • operator <, <=, >, >=, == 또는 !=
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수
로그 경보 쿼리

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

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • index_name 다중 인덱스 조직의 경우, 요청이 수행되는 로그 인덱스입니다.
  • rollup_method 통계 롤업 메서드, count, avg 및 cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
복합 조건 쿼리

예: 12345 && 67890(12345와 67890은 복합 조건이 아닌 모니터의 ID)

  • name [필수, 기본값 = 동적, 쿼리 기반]: 경보의 이름입니다.
  • message [필수, 기본값 = 동적, 쿼리 기반]: 이 모니터에 대한 알림에 포함할 메시지입니다. 이메일 알림은 이벤트와 동일한 '@username' 표기법을 사용하여 특정 사용자에게 보낼 수 있습니다.
  • tags [선택 사항, 기본값 = 빈 목록]: 모니터와 연결할 태그 목록입니다. API를 통해 모든 모니터 세부 정보를 가져올 때 monitor_tags 인수를 사용하여 이러한 태그별로 결과를 필터링하세요. API를 통해서만 사용할 수 있으며 Datadog UI에서는 표시하거나 편집할 수 없습니다.
SLO 경보 쿼리

예시: error_budget("slo_id").over("time_window") operator #

  • slo_id: 경보를 구성하려는 SLO의 영숫자 SLO ID입니다.
  • time_window: 경보를 보낼 SLO 대상의 시간 범위입니다. 유효한 옵션: 7d, 30d, 90d.
  • operator: >= or >
감사 경보 쿼리

예: audits(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg 및 cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
CI Pipelines 경보 쿼리

예: ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
CI Tests 경보 쿼리

예: ci-tests(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
Error Tracking 경보 쿼리

"새로운 이슈" 예: error-tracking(query).source(issue_source).new().rollup(rollup_method[, measure]).by(group_by).last(time_window) operator # "영향이 큰 이슈" 예: error-tracking(query).source(issue_source).impact().rollup(rollup_method[, measure]).by(group_by).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • issue_source 이슈 소스, all, browser, mobile, backend를 지원하며 생략 시 기본값은 all입니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원하며 생략 시 기본값은 count입니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • group by 그룹화할 속성의 쉼표로 구분된 목록, 최소한 issue.id를 포함해야 합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.

Database Monitoring 경보 쿼리

예: database-monitoring(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.

네트워크 성능 경보 쿼리

예: network-performance(query).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.

비용 경보 쿼리

예: formula(query).timeframe_type(time_window).function(parameter) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • timeframe_type 비용을 평가할 타임프레임 유형 - forecast의 경우 current를 지원합니다. - change, anomaly, threshold의 경우 last를 지원합니다.
  • time_window - 일일 롤업을 지원합니다(예: 7d).
  • function - [선택 사항, 생략 시 기본값은 threshold 모니터] change, anomaly, forecast를 지원합니다.
  • parameter 해당 유형의 파라미터를 지정합니다.
    • change의 경우
      • relative, absolute를 지원합니다.
      • [선택 사항] #을 지원하며, 여기서 #은 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
    • anomaly의 경우
      • direction=both, direction=above, direction=below를 지원합니다.
      • [선택 사항] threshold=#을 지원하며, 여기서 #은 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.
  • operator
    • threshold의 경우 <, <=, >, >=, == 또는 !=를 지원합니다.
    • change의 경우 >, <를 지원합니다.
    • anomaly의 경우 >=를 지원합니다.
    • forecast의 경우 >를 지원합니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.

Network Path 경보 쿼리

예 network-path(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #

  • query 검색 쿼리, 로그 검색 구문을 따릅니다.
  • index_name 모니터링할 데이터 유형으로, netpath-path 및 netpath-hop을 지원합니다.
  • rollup_method 통계 롤업 메서드, count, avg, cardinality를 지원합니다.
  • measure avg 및 카디널리티 rollup_method 대상, 사용할 측정값 또는 패싯 이름을 지정합니다.
  • time_window #m(1에서 2880 사이), #h(1에서 48 사이)입니다.
  • operator <, <=, >, >=, == 또는 !=입니다.
  • # 임계값을 설정하는 데 사용되는 정수 또는 십진수입니다.

This endpoint requires any of the following permissions:

  • monitors_write
  • monitors_draft_write

OAuth apps require one of the following authorization scopes to access this endpoint: monitors_write, monitors_draft_write.

요청

Body Data (required)

모니터 요청 본문을 생성합니다.

항목
유형
설명
assets
[object]

모니터를 설명하는 객체입니다.

draft_status
enum

Indicates whether the monitor is in a draft or published state.

draft: The monitor appears as Draft and does not send notifications. published: The monitor is active and evaluates conditions and notify as configured.

This field is in preview. The draft value is only available to customers with the feature enabled.

Default: published
Allowed enum values: draft, published
matching_downtimes
[object]

A list of active v1 downtimes that match this monitor.

message
string

A message to include with notifications for this monitor.

name
string

The monitor name.

options
object

List of options associated with your monitor.

priority
int64

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

query [required]
string

The monitor query.

restricted_roles
[string]

A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the Roles API and are located in the data.id field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. You can use the Restriction Policies API to manage write authorization for individual monitors by teams and users, in addition to roles.

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
Show 13 moreslo alert, event-v2 alert, audit alert, ci-pipelines alert, ci-tests alert, error-tracking alert, database-monitoring alert, network-performance alert, cost alert, data-quality alert, network-path alert, data-jobs alert, llm-observability alert

응답

OK

Object describing a monitor.

항목
유형
설명
assets
[object]

The list of monitor assets tied to a monitor, which represents key links for users to take action on monitor alerts (for example, runbooks).

created
date-time

Timestamp of the monitor creation.

creator
object

Object describing the creator of the shared element.

deleted
date-time

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

draft_status
enum

Indicates whether the monitor is in a draft or published state.

draft: The monitor appears as Draft and does not send notifications. published: The monitor is active and evaluates conditions and notify as configured.

This field is in preview. The draft value is only available to customers with the feature enabled.

Default: published
Allowed enum values: draft, published
id
int64

ID of this monitor.

matching_downtimes
[object]

A list of active v1 downtimes that match 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.

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 unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the Roles API and are located in the data.id field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. You can use the Restriction Policies API to manage write authorization for individual monitors by teams and users, in addition to roles.

state
object

Wrapper object with the different monitor states.

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
Show 13 moreslo alert, event-v2 alert, audit alert, ci-pipelines alert, ci-tests alert, error-tracking alert, database-monitoring alert, network-performance alert, cost alert, data-quality alert, network-path alert, data-jobs alert, llm-observability alert

코드 예시

Create a Cost Monitor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example Monitor",
  "type": "cost alert",
  "query": "formula(\"exclude_null(query1)\").last(\"7d\").anomaly(direction=\"above\", threshold=10) >= 5",
  "message": "some message Notify: @hipchat-channel",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 5,
      "warning": 3
    },
    "variables": [
      {
        "data_source": "cloud_cost",
        "query": "sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)",
        "name": "query1",
        "aggregator": "sum"
      }
    ],
    "include_tags": true
  }
}
EOF
Create a Data Jobs monitor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-jobs alert",
  "query": "formula(\"failed_runs(run_query)\").by(job_name,workspace_name).last(10d) > 0",
  "message": "Data jobs alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "options": {
    "thresholds": {
      "critical": 0
    },
    "variables": [
      {
        "name": "run_query",
        "jobs_query": "job_name:*",
        "job_type": "databricks.job",
        "query_dialect": "metric"
      }
    ]
  }
}
EOF
Create a Data Quality monitor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/monitor" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "name": "Example-Monitor",
  "type": "data-quality alert",
  "query": "formula(\"query1\").last(\"5m\") > 100",
  "message": "Data quality alert triggered",
  "tags": [
    "test:examplemonitor",
    "env:ci"
  ],
  "priority": 3,
  "options": {
    "thresholds": {
      "critical": 100
    },
    "variables": [
      {
        "name": "query1",
        "data_source": "data_quality_metrics",
        "measure": "row_count",
        "filter": "search for column where `database:production AND table:users`",
        "group_by": [
          "entity_id"
        ]
      }
    ]
  }
}
EOF