diff --git a/cloud/azure/mysql/README.md b/cloud/azure/mysql/README.md index aaed9e4..b8ccb26 100644 --- a/cloud/azure/mysql/README.md +++ b/cloud/azure/mysql/README.md @@ -16,6 +16,7 @@ module "datadog-monitors-cloud-azure-mysql" { Creates DataDog monitors with the following checks: +- Mysql Server compute consumption is high - Mysql Server CPU usage is high - Mysql Server has no connection - Mysql Server IO consumption is high @@ -26,6 +27,12 @@ Creates DataDog monitors with the following checks: | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| +| compute_consumption_message | Custom message for Mysql compute consumption monitor | string | `` | no | +| compute_consumption_silenced | Groups to mute for Mysql compute consumption monitor | map | `{}` | no | +| compute_consumption_threshold_critical | Mysql compute consumption in percent (critical threshold) | string | `90` | no | +| compute_consumption_threshold_warning | Mysql compute consumption in percent (warning threshold) | string | `80` | no | +| compute_consumption_time_aggregator | Monitor aggregator for Mysql compute consumption [available values: min, max or avg] | string | `min` | no | +| compute_consumption_timeframe | Monitor timeframe for Mysql compute consumption [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | | cpu_usage_message | Custom message for Mysql CPU monitor | string | `` | no | | cpu_usage_silenced | Groups to mute for Mysql CPU monitor | map | `{}` | no | | cpu_usage_threshold_critical | Mysql CPU usage in percent (critical threshold) | string | `90` | no | @@ -64,6 +71,7 @@ Creates DataDog monitors with the following checks: | Name | Description | |------|-------------| +| mysql_compute_consumption_id | id for monitor mysql_compute_consumption | | mysql_cpu_usage_id | id for monitor mysql_cpu_usage | | mysql_free_storage_id | id for monitor mysql_free_storage | | mysql_io_consumption_id | id for monitor mysql_io_consumption | diff --git a/cloud/azure/mysql/inputs.tf b/cloud/azure/mysql/inputs.tf index ff5d994..d36d15d 100644 --- a/cloud/azure/mysql/inputs.tf +++ b/cloud/azure/mysql/inputs.tf @@ -151,6 +151,40 @@ variable "io_consumption_threshold_critical" { default = "90" } +variable "compute_consumption_silenced" { + description = "Groups to mute for Mysql compute consumption monitor" + type = "map" + default = {} +} + +variable "compute_consumption_message" { + description = "Custom message for Mysql compute consumption monitor" + type = "string" + default = "" +} + +variable "compute_consumption_time_aggregator" { + description = "Monitor aggregator for Mysql compute consumption [available values: min, max or avg]" + type = "string" + default = "min" +} + +variable "compute_consumption_timeframe" { + description = "Monitor timeframe for Mysql compute consumption [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + type = "string" + default = "last_15m" +} + +variable "compute_consumption_threshold_warning" { + description = "Mysql compute consumption in percent (warning threshold)" + default = "80" +} + +variable "compute_consumption_threshold_critical" { + description = "Mysql compute consumption in percent (critical threshold)" + default = "90" +} + variable "memory_usage_silenced" { description = "Groups to mute for Mysql memory monitor" type = "map" diff --git a/cloud/azure/mysql/monitors-mysql.tf b/cloud/azure/mysql/monitors-mysql.tf index ddde5be..6a4e6a6 100644 --- a/cloud/azure/mysql/monitors-mysql.tf +++ b/cloud/azure/mysql/monitors-mysql.tf @@ -129,6 +129,38 @@ resource "datadog_monitor" "mysql_io_consumption" { tags = ["env:${var.environment}", "resource:mysql", "team:azure", "provider:azure"] } +resource "datadog_monitor" "mysql_compute_consumption" { + name = "[${var.environment}] Mysql Server compute consumption is high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = "${coalesce(var.compute_consumption_message, var.message)}" + + query = < ${var.compute_consumption_threshold_critical} + EOF + + type = "metric alert" + + thresholds { + critical = "${var.compute_consumption_threshold_critical}" + warning = "${var.compute_consumption_threshold_warning}" + } + + silenced = "${var.compute_consumption_silenced}" + + 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}" + + tags = ["env:${var.environment}", "resource:mysql", "team:azure", "provider:azure"] +} + resource "datadog_monitor" "mysql_memory_usage" { name = "[${var.environment}] Mysql Server memory usage is high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.memory_usage_message, var.message)}" diff --git a/cloud/azure/mysql/outputs.tf b/cloud/azure/mysql/outputs.tf index f037a3f..b064939 100644 --- a/cloud/azure/mysql/outputs.tf +++ b/cloud/azure/mysql/outputs.tf @@ -18,6 +18,11 @@ output "mysql_io_consumption_id" { value = "${datadog_monitor.mysql_io_consumption.*.id}" } +output "mysql_compute_consumption_id" { + description = "id for monitor mysql_compute_consumption" + value = "${datadog_monitor.mysql_compute_consumption.*.id}" +} + output "mysql_memory_usage_id" { description = "id for monitor mysql_memory_usage" value = "${datadog_monitor.mysql_memory_usage.*.id}"