resource "datadog_monitor" "mysql_availability" { count = "${var.mysql_availability_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql server does not respond" message = "${coalesce(var.mysql_availability_message, var.message)}" type = "service check" query = < ${var.mysql_connection_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { warning = "${var.mysql_connection_threshold_warning}" critical = "${var.mysql_connection_threshold_critical}" } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_connection_extra_tags}"] } resource "datadog_monitor" "mysql_aborted" { count = "${var.mysql_aborted_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.mysql_aborted_message, var.message)}" type = "query alert" query = < ${var.mysql_aborted_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { warning = "${var.mysql_aborted_threshold_warning}" critical = "${var.mysql_aborted_threshold_critical}" } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_aborted_extra_tags}"] } resource "datadog_monitor" "mysql_slow" { count = "${var.mysql_slow_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.mysql_slow_message, var.message)}" type = "query alert" query = < ${var.mysql_slow_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { warning = "${var.mysql_slow_threshold_warning}" critical = "${var.mysql_slow_threshold_critical}" } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_slow_extra_tags}"] } resource "datadog_monitor" "mysql_pool_efficiency" { count = "${var.mysql_pool_efficiency_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Innodb buffer pool efficiency {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = "${coalesce(var.mysql_pool_efficiency_message, var.message)}" type = "query alert" query = < ${var.mysql_pool_efficiency_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { warning = "${var.mysql_pool_efficiency_threshold_warning}" critical = "${var.mysql_pool_efficiency_threshold_critical}" } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_pool_efficiency_extra_tags}"] } resource "datadog_monitor" "mysql_pool_utilization" { count = "${var.mysql_pool_utilization_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Innodb buffer pool utilization {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = "${coalesce(var.mysql_pool_utilization_message, var.message)}" type = "query alert" query = < ${var.mysql_pool_utilization_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { warning = "${var.mysql_pool_utilization_threshold_warning}" critical = "${var.mysql_pool_utilization_threshold_critical}" } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_pool_utilization_extra_tags}"] } resource "datadog_monitor" "mysql_threads_anomaly" { count = "${var.mysql_threads_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" message = "${coalesce(var.mysql_threads_message, var.message)}" type = "metric alert" query = <= ${var.mysql_threads_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { critical = "${var.mysql_threads_threshold_critical}" critical_recovery = 0 } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_threads_extra_tags}"] } resource "datadog_monitor" "mysql_questions_anomaly" { count = "${var.mysql_questions_enabled == "true" ? 1 : 0}" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" message = "${coalesce(var.mysql_questions_message, var.message)}" type = "metric alert" query = <= ${var.mysql_questions_threshold_critical} EOQ evaluation_delay = "${var.evaluation_delay}" new_host_delay = "${var.new_host_delay}" thresholds { critical = "${var.mysql_questions_threshold_critical}" critical_recovery = 0 } notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_questions_extra_tags}"] }