Datadog
Query Datadog monitors and timeseries metrics, and post events to the Datadog event stream, using the Datadog v1 REST API (https://docs.datadoghq.com/api/latest/).
Standard-library Python only (urllib, json) — no external dependencies.
Response bodies are returned as a JSON string in result along with the HTTP
status; bodies are capped at ~5 MB.
Operations
| operation | method & endpoint | required inputs | keys needed |
|---|---|---|---|
list_monitors |
GET /api/v1/monitor |
— | apiKey + appKey |
get_monitor |
GET /api/v1/monitor/{monitorId} |
monitorId |
apiKey + appKey |
query_metrics |
GET /api/v1/query?from=&to=&query= |
query, from, to |
apiKey + appKey |
post_event |
POST /api/v1/events |
title, text |
apiKey only |
from / to are UNIX epoch seconds. Optional post_event inputs:
tags (comma-separated), alertType (error/warning/info/success),
priority (normal/low).
Authentication
Datadog authenticates with two headers:
DD-API-KEY— your API keyDD-APPLICATION-KEY— your Application key (read/query endpoints)
Create them in Datadog under Organization Settings:
- API Keys → New Key → copy into the
apiKeyinput. - Application Keys → New Key → copy into the
appKeyinput.
post_event needs only apiKey. list_monitors, get_monitor and
query_metrics need both apiKey and appKey.
Region / site
Default site is datadoghq.com (US1). Override the site input for other
regions — e.g. datadoghq.eu, us3.datadoghq.com, us5.datadoghq.com,
ap1.datadoghq.com, ddog-gov.com. Requests go to https://api.<site>.
Examples
List all monitors:
operation = list_monitors
apiKey = <your-api-key>
appKey = <your-app-key>
Query the last hour of host CPU idle (epoch seconds for from/to):
operation = query_metrics
apiKey = <your-api-key>
appKey = <your-app-key>
query = avg:system.cpu.idle{*}
from = 1718200000
to = 1718203600
Post a deployment event:
operation = post_event
apiKey = <your-api-key>
title = Deploy: api v8.0.0
text = Rolled out api v8.0.0 to prod
tags = env:prod,team:sre
alertType = info
Publishes
The keys a later task may reference as {{taskName.key}}. Referencing anything not listed here resolves to nothing at run time.
errorresultstatustruncated
Input Properties
Every property this tool accepts, from its own tool.iml.
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey |
string | yes | — | DEPRECATED — bind an API Key credential to the task with credentialName instead. A key pasted here is stored in the workflow definition in clear and appears in every export of it. Still honoured for workflows built before the change. |
operation |
string | yes | — | One of: list_monitors, get_monitor, query_metrics, post_event |
appKey |
string | no | — | Datadog Application key (Organization Settings > Application Keys). Sent as 'DD-APPLICATION-KEY'. Required for list_monitors, get_monitor and query_metrics (read/query endpoints). Not needed for post_event. |
site |
string | no | datadoghq.com |
Optional Datadog site/region host suffix, e.g. datadoghq.com (US, default), datadoghq.eu (EU), us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ddog-gov.com. The request is sent to https://api. |
monitorId |
string | no | — | Numeric monitor ID. Required for get_monitor. |
query |
string | no | — | Metrics query string for query_metrics, e.g. 'system.cpu.idle{*}' or 'avg:system.load.1{host:web-01}'. Required for query_metrics. |
from |
string | no | — | Start of the query window for query_metrics, as a UNIX epoch seconds timestamp. Required for query_metrics. |
to |
string | no | — | End of the query window for query_metrics, as a UNIX epoch seconds timestamp. Required for query_metrics. |
title |
string | no | — | Event title. Required for post_event. |
text |
string | no | — | Event body text (supports Datadog markdown). Required for post_event. |
tags |
string | no | — | Optional comma-separated tags for post_event, e.g. 'env:prod,team:sre'. |
alertType |
string | no | — | Optional event alert_type for post_event: error, warning, info, or success. |
priority |
string | no | — | Optional event priority for post_event: normal or low. |