All URIs are relative to https://api.datadoghq.com
| Method | HTTP request | Description |
|---|---|---|
| checkCanDeleteMonitor | GET /api/v1/monitor/can_delete | Check if a monitor can be deleted |
| createMonitor | POST /api/v1/monitor | Create a monitor |
| deleteMonitor | DELETE /api/v1/monitor/{monitor_id} | Delete a monitor |
| getMonitor | GET /api/v1/monitor/{monitor_id} | Get a monitor's details |
| listMonitors | GET /api/v1/monitor | Get all monitor details |
| searchMonitorGroups | GET /api/v1/monitor/groups/search | Monitors group search |
| searchMonitors | GET /api/v1/monitor/search | Monitors search |
| updateMonitor | PUT /api/v1/monitor/{monitor_id} | Edit a monitor |
| validateMonitor | POST /api/v1/monitor/validate | Validate a monitor |
CheckCanDeleteMonitorResponse checkCanDeleteMonitor()
Check if the given monitors can be deleted.
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));| Name | Type | Description | Notes |
|---|---|---|---|
| monitorIds | Array<number> | The IDs of the monitor to check. | defaults to undefined |
CheckCanDeleteMonitorResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
| 409 | Deletion conflict error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Monitor createMonitor(body)
Create a monitor using the specified options.
The type of monitor chosen from:
- anomaly:
query alert - APM:
query alertortrace-analytics alert - composite:
composite - custom:
service check - event:
event alert - forecast:
query alert - host:
service check - integration:
query alertorservice check - live process:
process alert - logs:
log alert - metric:
metric alert - network:
service check - outlier:
query alert - process:
service check - rum:
rum alert - SLO:
slo alert - watchdog:
event alert - event-v2:
event-v2 alert - audit:
audit alert
Metric Alert Query
Example: time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator #
time_aggr: avg, sum, max, min, change, or pct_changetime_window:last_#m(with#between 1 and 10080 depending on the monitor type) orlast_#h(with#between 1 and 168 depending on the monitor type) orlast_1d, orlast_1wspace_aggr: avg, sum, min, or maxtags: one or more tags (comma-separated), or *key: a 'key' in key:value tag syntax; defines a separate alert for each tag in the group (multi-alert)operator: <, <=, >, >=, ==, or !=#: an integer or decimal number used to set the threshold
If you are using the _change_ or _pct_change_ time aggregator, instead use change_aggr(time_aggr(time_window), timeshift):space_aggr:metric{tags} [by {key}] operator # with:
change_aggrchange, pct_changetime_aggravg, sum, max, min Learn moretime_windowlast_#m (between 1 and 2880 depending on the monitor type), last_#h (between 1 and 48 depending on the monitor type), or last_#d (1 or 2)timeshift#m_ago (5, 10, 15, or 30), #h_ago (1, 2, or 4), or 1d_ago
Use this to create an outlier monitor using the following query:
avg(last_30m):outliers(avg:system.cpu.user{role:es-events-data} by {host}, 'dbscan', 7) > 0
Service Check Query
Example: "check".over(tags).last(count).by(group).count_by_status()
checkname of the check, e.g.datadog.agent.uptagsone or more quoted tags (comma-separated), or "*". e.g.:.over("env:prod", "role:db");overcannot be blank.countmust be at greater than or equal to your max threshold (defined in theoptions). It is limited to 100. For example, if you've specified to notify on 1 critical, 3 ok, and 2 warn statuses,countshould be at least 3.groupmust be specified for check monitors. Per-check grouping is already explicitly known for some service checks. For example, Postgres integration monitors are tagged bydb,host, andport, and Network monitors byhost,instance, andurl. See Service Checks documentation for more information.
Event Alert Query
Example: events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"
event, the event query string:string_queryfree text query to match against event title and text.sourcesevent sources (comma-separated).statusevent statuses (comma-separated). Valid options: error, warn, and info.priorityevent priorities (comma-separated). Valid options: low, normal, all.hostevent reporting host (comma-separated).tagsevent tags (comma-separated).excluded_tagsexcluded event tags (comma-separated).rollupthe stats roll-up method.countis the only supported method now.lastthe timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours.
NOTE Only available on US1 and EU.
Event V2 Alert Query
Example: events(query).rollup(rollup_method[, measure]).last(time_window) operator #
queryThe search query - following the Log search syntax.rollup_methodThe stats roll-up method - supportscount,avgandcardinality.measureForavgand cardinalityrollup_method- specify the measure or the facet name you want to use.time_window#m (between 1 and 2880), #h (between 1 and 48).operator<,<=,>,>=,==, or!=.#an integer or decimal number used to set the threshold.
NOTE Only available on US1-FED, US3, and in closed beta on EU and US1.
Process Alert Query
Example: processes(search).over(tags).rollup('count').last(timeframe) operator #
searchfree text search string for querying processes. Matching processes match results on the Live Processes page.tagsone or more tags (comma-separated)timeframethe timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and doperator<, <=, >, >=, ==, or !=#an integer or decimal number used to set the threshold
Logs Alert Query
Example: logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #
queryThe search query - following the Log search syntax.index_nameFor multi-index organizations, the log index in which the request is performed.rollup_methodThe stats roll-up method - supportscount,avgandcardinality.measureForavgand cardinalityrollup_method- specify the measure or the facet name you want to use.time_window#m (between 1 and 2880), #h (between 1 and 48).operator<,<=,>,>=,==, or!=.#an integer or decimal number used to set the threshold.
Composite Query
Example: 12345 && 67890, where 12345 and 67890 are the IDs of non-composite monitors
name[required, default = dynamic, based on query]: The name of the alert.message[required, default = dynamic, based on query]: A message to include with notifications for this monitor. Email notifications can be sent to specific users by using the same '@username' notation as events.tags[optional, default = empty list]: A list of tags to associate with your monitor. When getting all monitor details via the API, use themonitor_tagsargument to filter results by these tags. It is only available via the API and isn't visible or editable in the Datadog UI.
SLO Alert Query
Example: error_budget("slo_id").over("time_window") operator #
slo_id: The alphanumeric SLO ID of the SLO you are configuring the alert for.time_window: The time window of the SLO target you wish to alert on. Valid options:7d,30d,90d.operator:>=or>
Audit Alert Query
Example: audits(query).rollup(rollup_method[, measure]).last(time_window) operator #
queryThe search query - following the Log search syntax.rollup_methodThe stats roll-up method - supportscount,avgandcardinality.measureForavgand cardinalityrollup_method- specify the measure or the facet name you want to use.time_window#m (between 1 and 2880), #h (between 1 and 48).operator<,<=,>,>=,==, or!=.#an integer or decimal number used to set the threshold.
NOTE Only available on US1-FED and in closed beta on EU, US3, and US1.
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,
renotifyOccurrences: 1,
renotifyStatuses: ["alert"],
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));| Name | Type | Description | Notes |
|---|---|---|---|
| body | Monitor | Create a monitor request body. |
Monitor
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeletedMonitor deleteMonitor()
Delete the specified monitor
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));| Name | Type | Description | Notes |
|---|---|---|---|
| monitorId | [number] | The ID of the monitor. | defaults to undefined |
| force | [string] | Delete the monitor even if it's referenced by other resources (e.g. SLO, composite monitor). | (optional) defaults to undefined |
DeletedMonitor
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 401 | Authentication error | - |
| 403 | Forbidden | - |
| 404 | Item not found error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Monitor getMonitor()
Get details about the specified monitor from your organization.
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));| Name | Type | Description | Notes |
|---|---|---|---|
| monitorId | [number] | The ID of the monitor | defaults to undefined |
| groupStates | [string] | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. | (optional) defaults to undefined |
Monitor
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Authentication error | - |
| 404 | Monitor Not Found error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Array listMonitors()
Get details about the specified monitor from your organization.
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));| Name | Type | Description | Notes |
|---|---|---|---|
| groupStates | [string] | When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`. | (optional) defaults to undefined |
| name | [string] | A string to filter monitors by name. | (optional) defaults to undefined |
| 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`. | (optional) defaults to undefined |
| monitorTags | [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) defaults to undefined |
| withDowntimes | [boolean] | If this argument is set to true, then the returned data includes all current active downtimes for each monitor. | (optional) defaults to undefined |
| idOffset | [number] | Monitor ID offset. | (optional) defaults to undefined |
| page | [number] | The page to start paginating from. If this argument is not specified, the request returns all monitors without pagination. | (optional) defaults to undefined |
| pageSize | [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) defaults to undefined |
Array
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MonitorGroupSearchResponse searchMonitorGroups()
Search and filter your monitor groups details.
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/#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));| Name | Type | Description | Notes |
|---|---|---|---|
| query | [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/#find-the-monitors | (optional) defaults to undefined |
| page | [number] | Page to start paginating from. | (optional) defaults to 0 |
| perPage | [number] | Number of monitors to return per page. | (optional) defaults to 30 |
| 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` | (optional) defaults to undefined |
MonitorGroupSearchResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MonitorSearchResponse searchMonitors()
Search and filter your monitors details.
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/#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));| Name | Type | Description | Notes |
|---|---|---|---|
| query | [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/#find-the-monitors | (optional) defaults to undefined |
| page | [number] | Page to start paginating from. | (optional) defaults to 0 |
| perPage | [number] | Number of monitors to return per page. | (optional) defaults to 30 |
| 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` | (optional) defaults to undefined |
MonitorSearchResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Monitor updateMonitor(body)
Edit the specified monitor.
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,
renotifyOccurrences: 1,
renotifyStatuses: ["alert"],
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));| Name | Type | Description | Notes |
|---|---|---|---|
| body | MonitorUpdateRequest | Edit a monitor request body. | |
| monitorId | [number] | The ID of the monitor. | defaults to undefined |
Monitor
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 401 | Authentication error | - |
| 403 | Forbidden | - |
| 404 | Monitor Not Found error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
any validateMonitor(body)
Validate the monitor provided in the request.
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.MonitorsApiValidateMonitorRequest = {
// Monitor | Monitor request object
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,
renotifyOccurrences: 1,
renotifyStatuses: ["alert"],
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
.validateMonitor(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));| Name | Type | Description | Notes |
|---|---|---|---|
| body | Monitor | Monitor request object |
any
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Invalid JSON | - |
| 403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]