diff --git a/README.md b/README.md index ca132ec..60ed088 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ The `//` is very important, it's a terraform specific syntax used to separate gi - [filter-tags](https://bitbucket.org/morea/terraform.feature.datadog/src/master/common/filter-tags/) - [database](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/) - [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mongodb/) + - [mysql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mysql/) - [redis](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/redis/) - [middleware](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/) - [apache](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/apache/) diff --git a/database/mysql/README.md b/database/mysql/README.md index ea48614..d56cd43 100644 --- a/database/mysql/README.md +++ b/database/mysql/README.md @@ -1,44 +1,48 @@ -MySQL DataDog monitors -====================== +# DATABASE MYSQL DataDog monitors -How to use this module ----------------------- +## How to use this module ``` -module "datadog-monitors-mysql" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//databases/mysql?ref={revision}" +module "datadog-monitors-database-mysql" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//database/mysql?ref={revision}" environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + message = "${module.datadog-message-alerting.alerting-message}" } ``` -Purpose -------- -Creates DataDog monitors with the following checks : +## Purpose -* MySQL Connections too high -* MySQL Number of threads too high +Creates DataDog monitors with the following checks: -Inputs ------- +- Mysql Connections +- Mysql threads + +## Inputs | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | delay | Delay in seconds for the metric evaluation | string | `15` | no | | environment | Environment | string | - | yes | -| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | 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_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_connection_silenced | Groups to mute mysql connection monitor | map | `` | no | -| mysql_connection_message | Custom message for MySQL connection monitor | string | `` | 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 | | mysql_thread_threshold_warning | Maximum warning acceptable number of threads | string | `400` | no | -| mysql_thread_silenced | Groups to mute mysql threads monitor | map | `` | no | -| mysql_thread_message | Custom message for MySQL thread monitor | string | `` | no | -| message | Message sent when a monitor is triggered | string | - | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| mysql_connection_too_high_id | id for monitor mysql_connection_too_high | +| mysql_thread_too_high_id | id for monitor mysql_thread_too_high | Related documentation --------------------- diff --git a/database/mysql/modules.tf b/database/mysql/modules.tf new file mode 100644 index 0000000..a494121 --- /dev/null +++ b/database/mysql/modules.tf @@ -0,0 +1,8 @@ +module "filter-tags" { + source = "../../common/filter-tags" + + environment = "${var.environment}" + resource = "mysql" + filter_tags_use_defaults = "${var.filter_tags_use_defaults}" + filter_tags_custom = "${var.filter_tags_custom}" +} diff --git a/database/mysql/mon-mysql.tf b/database/mysql/monitors-mysql.tf similarity index 100% rename from database/mysql/mon-mysql.tf rename to database/mysql/monitors-mysql.tf diff --git a/database/mysql/outputs.tf b/database/mysql/outputs.tf new file mode 100644 index 0000000..c12fb69 --- /dev/null +++ b/database/mysql/outputs.tf @@ -0,0 +1,9 @@ +output "mysql_connection_too_high_id" { + description = "id for monitor mysql_connection_too_high" + value = "${datadog_monitor.mysql_connection_too_high.id}" +} + +output "mysql_thread_too_high_id" { + description = "id for monitor mysql_thread_too_high" + value = "${datadog_monitor.mysql_thread_too_high.id}" +}