diff --git a/database/mysql/README.md b/database/mysql/README.md index 05d8d16..8728aaf 100644 --- a/database/mysql/README.md +++ b/database/mysql/README.md @@ -28,10 +28,12 @@ Creates DataDog monitors with the following checks: | filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no | | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | message | Message sent when an alert is triggered | string | - | yes | +| mysql_connection_extra_tags | Extra tags for MySQL connection monitor | list | `` | no | | mysql_connection_message | Custom message for MySQL connection monitor | string | `` | no | | mysql_connection_silenced | Groups to mute mysql connection monitor | map | `` | no | | mysql_connection_threshold_critical | Maximum critical acceptable percent of connections | string | `80` | no | | mysql_connection_threshold_warning | Maximum warning acceptable percent of connections | string | `70` | no | +| mysql_thread_extra_tags | Extra tags for MySQL thread monitor | list | `` | no | | mysql_thread_message | Custom message for MySQL thread monitor | string | `` | no | | mysql_thread_silenced | Groups to mute mysql threads monitor | map | `` | no | | mysql_thread_threshold_critical | Maximum critical acceptable number of threads | string | `500` | no | diff --git a/database/mysql/inputs.tf b/database/mysql/inputs.tf index 9a417c3..35ed6df 100644 --- a/database/mysql/inputs.tf +++ b/database/mysql/inputs.tf @@ -54,6 +54,12 @@ variable "mysql_connection_message" { default = "" } +variable "mysql_connection_extra_tags" { + description = "Extra tags for MySQL connection monitor" + type = "list" + default = [] +} + ################################# ### MySQL threads ### ################################# @@ -79,3 +85,9 @@ variable "mysql_thread_message" { type = "string" default = "" } + +variable "mysql_thread_extra_tags" { + description = "Extra tags for MySQL thread monitor" + type = "list" + default = [] +} diff --git a/database/mysql/monitors-mysql.tf b/database/mysql/monitors-mysql.tf index 4ba9196..5eae56f 100644 --- a/database/mysql/monitors-mysql.tf +++ b/database/mysql/monitors-mysql.tf @@ -18,7 +18,7 @@ resource "datadog_monitor" "mysql_connection_too_high" { critical = "${var.mysql_connection_threshold_critical}" } - notify_no_data = true + notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 @@ -26,7 +26,7 @@ resource "datadog_monitor" "mysql_connection_too_high" { silenced = "${var.mysql_connection_silenced}" - tags = ["env:${var.environment}", "resource:mysql"] + tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_connection_extra_tags}"] } resource "datadog_monitor" "mysql_thread_too_high" { @@ -48,7 +48,7 @@ resource "datadog_monitor" "mysql_thread_too_high" { critical = "${var.mysql_thread_threshold_critical}" } - notify_no_data = true + notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 @@ -56,5 +56,5 @@ resource "datadog_monitor" "mysql_thread_too_high" { silenced = "${var.mysql_thread_silenced}" - tags = ["env:${var.environment}", "resource:mysql"] + tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_thread_extra_tags}"] }