# Monitors related to ECS Cluster resource "datadog_monitor" "ecs_agent_status" { count = var.agent_status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ECS Agent disconnected {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.agent_status_message, var.message) type = "service check" query = < ${var.cluster_cpu_utilization_threshold_critical} EOQ thresholds = { critical = var.cluster_cpu_utilization_threshold_critical warning = var.cluster_cpu_utilization_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false require_full_window = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:ecs", "team:claranet", "created-by:terraform", "category:cluster"], var.cluster_cpu_utilization_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "cluster_memory_reservation" { count = var.cluster_memory_reservation_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ECS Cluster Memory Reservation High {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.cluster_memory_reservation_message, var.message) type = "metric alert" query = < ${var.cluster_memory_reservation_threshold_critical} EOQ thresholds = { critical = var.cluster_memory_reservation_threshold_critical warning = var.cluster_memory_reservation_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false require_full_window = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:ecs", "team:claranet", "created-by:terraform", "category:cluster"], var.cluster_memory_reservation_extra_tags) lifecycle { ignore_changes = ["silenced"] } }