data "template_file" "filter" { template = "$${filter}" vars { filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_mem:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}" } } module "datadog-monitors-aws-elasticcache-common" { source = "../common" message = "${var.message}" environment = "${var.environment}" filter_tags = "${data.template_file.filter.rendered}" resource = "memcached" } resource "datadog_monitor" "memcached_get_hits" { name = "[${var.environment}] Elasticache memcached get hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.get_hits_message, var.message)}" type = "metric alert" query = < ${var.cpu_high_threshold_critical} EOF thresholds { warning = "${var.cpu_high_threshold_warning}" critical = "${var.cpu_high_threshold_critical}" } notify_no_data = true evaluation_delay = "${var.delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.delay}" silenced = "${var.cpu_high_silenced}" tags = ["env:${var.environment}", "engine:memcached", "team:aws", "provider:aws"] } resource "datadog_monitor" "memcached_swap" { name = "[${var.environment}] Elasticache memcached swap {{#is_alert}}{{{comparator}}} {{threshold}}MB ({{value}}MB){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}MB ({{value}}MB){{/is_warning}}" message = "${coalesce(var.swap_message, var.message)}" type = "metric alert" query = < ${var.swap_threshold_critical} EOF thresholds { warning = "${var.swap_threshold_warning}" critical = "${var.swap_threshold_critical}" } notify_no_data = false evaluation_delay = "${var.delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.delay}" silenced = "${var.swap_silenced}" tags = ["env:${var.environment}", "engine:memcached", "team:aws", "provider:aws"] } resource "datadog_monitor" "memcached_free_memory" { name = "[${var.environment}] Elasticache memcached free memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.free_memory_message, var.message)}" type = "metric alert" query = <