Import DataDog monitor rule and generate Terraform resource configuration
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Gemfile
LICENSE
README.md
monitor-import.rb

README.md

datadog_monitor2terraform

Import DataDog monitor rule and generate Terraform resource configuration

Setup

$ git clone https://github.com/kurochan/datadog_monitor2terraform
$ bundle install

Usage

$ ruby ./monitor-import.rb [monitor_name] [monitor_id]

example

$ export DATADOG_API_KEY='datadogapikeydatadogapikey'
$ export DATADOG_APP_KEY='datadogappkeydatadogappkeydatadogappkey'

$ ruby ./monitor-import.rb dynamodb_user_error_count 112233

resource "datadog_monitor" "dynamodb_user_error_count" {
  name               = "DynamoDB UserError count is above the Threshold !!"
  type               = "metric alert"
  message            = <<EOF
@slack-metric-alert DynamoDB UserError count is above the Threshold !!
EOF
  query = "sum(last_5m):sum:aws.dynamodb.user_errors{*} > 10"
  thresholds {
    warning = 5.0
    critical = 10.0
  }
  notify_no_data = false
  no_data_timeframe = 2
  renotify_interval = 0
  timeout_h = 0
  require_full_window = true
  notify_audit = false
  tags = []
}