InTouch Hub · Blue Isle Software

Datadog

Query Datadog monitors and timeseries metrics and post events via the Datadog v1 REST API.

Provided free and as is, without warranty of any kind — including merchantability, fitness for a particular purpose, and the accuracy or completeness of any result. See the licence. You are responsible for checking what this produces before relying on it.

deploydeveloper-devopsdevopsmetricsmonitormonitoringstatus

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:

Create them in Datadog under Organization Settings:

  1. API Keys → New Key → copy into the apiKey input.
  2. Application Keys → New Key → copy into the appKey input.

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.

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.