datadog_monitor (Resource)

Provides a Datadog monitor resource. This can be used to create and manage Datadog monitors.

Example Usage

resource "datadog_monitor" "foo" {
  name               = "Name for monitor foo"
  type               = "metric alert"
  message            = "Monitor triggered. Notify: @hipchat-channel"
  escalation_message = "Escalation message @pagerduty"

  query = "avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4"

  monitor_thresholds {
    warning  = 2
    critical = 4
  }

  include_tags = true

  tags = ["foo:bar", "team:fooBar"]
}

Schema

Required

Email notifications can be sent to specific users by using the same @username notation as events.

Note: APM latency data is now available as Distribution Metrics. Existing monitors have been migrated automatically but all terraformed monitors can still use the existing metrics. We strongly recommend updating monitor definitions to query the new metrics. To learn more, or to see examples of how to update your terraform definitions to utilize the new distribution metrics, see the detailed doc.

Optional

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 will evaluate data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor will always have data during evaluation.

new_group_delay overrides new_host_delay if it is set to a nonzero value.

We recommend at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. Defaults to 10.

Read-Only

Nested Schema for monitor_threshold_windows

Optional:

Nested Schema for monitor_thresholds

Optional:

Nested Schema for scheduling_options

Optional:

Nested Schema for scheduling_options.custom_schedule

Required:

Nested Schema for scheduling_options.custom_schedule.recurrence

Required:

Optional:

Nested Schema for scheduling_options.evaluation_window

Optional:

Nested Schema for variables

Optional:

Nested Schema for variables.event_query

Required:

Optional:

Nested Schema for variables.event_query.compute

Required:

Optional:

Nested Schema for variables.event_query.search

Required:

Nested Schema for variables.event_query.group_by

Required:

Optional:

Nested Schema for variables.event_query.group_by.sort

Required:

Optional:

Import

Import is supported using the following syntax:

terraform import datadog_monitor.bytes_received_localhost 2081