# Monitoring App Gateway status resource "datadog_monitor" "appgateway_status" { count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway is down" message = coalesce(var.status_message, var.message) type = "metric alert" query = < ${var.appgateway_backend_connect_time_threshold_critical} EOQ monitor_thresholds { critical = var.appgateway_backend_connect_time_threshold_critical warning = var.appgateway_backend_connect_time_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_backend_connect_time_extra_tags) } # Monitoring App Gateway failed_requests resource "datadog_monitor" "appgateway_failed_requests" { count = var.appgateway_failed_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_failed_requests_message, var.message) type = "query alert" query = < ${var.appgateway_failed_requests_threshold_critical} EOQ monitor_thresholds { critical = var.appgateway_failed_requests_threshold_critical warning = var.appgateway_failed_requests_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_failed_requests_extra_tags) } # Monitoring App Gateway unhealthy_host_ratio resource "datadog_monitor" "appgateway_healthy_host_ratio" { count = var.appgateway_unhealthy_host_ratio_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway backend unhealthy host ratio is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_unhealthy_host_ratio_message, var.message) type = "query alert" query = < ${var.appgateway_unhealthy_host_ratio_threshold_critical} EOQ monitor_thresholds { critical = var.appgateway_unhealthy_host_ratio_threshold_critical warning = var.appgateway_unhealthy_host_ratio_threshold_warning } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_unhealthy_host_ratio_extra_tags) } # Monitoring App Gateway response_status 4xx resource "datadog_monitor" "appgateway_http_4xx_errors" { count = var.appgateway_http_4xx_errors_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway HTTP 4xx errors rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_http_4xx_errors_message, var.message) type = "query alert" query = < ${var.appgateway_http_4xx_errors_threshold_critical} EOQ monitor_thresholds { warning = var.appgateway_http_4xx_errors_threshold_warning critical = var.appgateway_http_4xx_errors_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false timeout_h = 1 include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_http_4xx_errors_extra_tags) } # Monitoring App Gateway response_status 5xx resource "datadog_monitor" "appgateway_http_5xx_errors" { count = var.appgateway_http_5xx_errors_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway HTTP 5xx errors rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_http_5xx_errors_message, var.message) type = "query alert" query = < ${var.appgateway_http_5xx_errors_threshold_critical} EOQ monitor_thresholds { warning = var.appgateway_http_5xx_errors_threshold_warning critical = var.appgateway_http_5xx_errors_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false timeout_h = 1 include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_http_5xx_errors_extra_tags) } # Monitoring App Gateway Backend response_status 4xx resource "datadog_monitor" "appgateway_backend_http_4xx_errors" { count = var.appgateway_backend_http_4xx_errors_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway backend HTTP 4xx errors rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_backend_http_4xx_errors_message, var.message) type = "query alert" query = < ${var.appgateway_backend_http_4xx_errors_threshold_critical} EOQ monitor_thresholds { warning = var.appgateway_backend_http_4xx_errors_threshold_warning critical = var.appgateway_backend_http_4xx_errors_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false timeout_h = 1 include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_backend_http_4xx_errors_extra_tags) } # Monitoring App Gateway Backend response_status 5xx resource "datadog_monitor" "appgateway_backend_http_5xx_errors" { count = var.appgateway_backend_http_5xx_errors_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway backend HTTP 5xx errors rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.appgateway_backend_http_5xx_errors_message, var.message) type = "query alert" query = < ${var.appgateway_backend_http_5xx_errors_threshold_critical} EOQ monitor_thresholds { warning = var.appgateway_backend_http_5xx_errors_threshold_warning critical = var.appgateway_backend_http_5xx_errors_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false timeout_h = 1 include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.appgateway_backend_http_5xx_errors_extra_tags) }