Skip to content

Instantly share code, notes, and snippets.

@utilus-bot
Created May 24, 2018 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save utilus-bot/161a22153e741e42d3b5c8bf20f2fb01 to your computer and use it in GitHub Desktop.
Save utilus-bot/161a22153e741e42d3b5c8bf20f2fb01 to your computer and use it in GitHub Desktop.
Terraform DataDog datadog_monitor resource
resource "datadog_monitor" "cannot_connect_http" {
name = "[${var.environment}] [${var.aws_region}] Connection to backend"
type = "metric alert"
message = "{{#is_recovery}}Can{{/is_recovery}}{{^is_recovery}}Cannot{{/is_recovery}} connect to {{url.name}} TCP endpoint in {{host.region}}.\nCheck message: {{check_message}}. Notify: @slack-environment-${var.environment}"
query = "\"tcp.can_connect\".over(\"environment:dev\",\"instance:my_app\",\"region:eu-central-1\").by(\"host\",\"instance\",\"port\",\"target_host\").last(3).count_by_status()"
thresholds {
critical = 2
ok = 2
warning = 1
}
notify_no_data = true
no_data_timeframe = 2
renotify_interval = 0
require_full_window = false
include_tags = true
tags = [
"project:${var.project}",
"environment:${var.environment}",
"region:${var.aws_region}",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment