From 75c9350667d021f3acde68b41b196c0af3966b06 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 30 Aug 2018 11:33:46 +0200 Subject: [PATCH] MON-224 delete duplicated monitors from mysql --- ...stance.tf => monitors-cloud-sql-common.tf} | 0 cloud/gcp/cloud-sql/mysql/README.md | 34 ---- cloud/gcp/cloud-sql/mysql/inputs.tf | 188 ------------------ .../mysql/monitors-cloudsql-mysql.tf | 92 --------- cloud/gcp/cloud-sql/mysql/outputs.tf | 10 - 5 files changed, 324 deletions(-) rename cloud/gcp/cloud-sql/common/{monitors-cloud-sql-instance.tf => monitors-cloud-sql-common.tf} (100%) diff --git a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-instance.tf b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf similarity index 100% rename from cloud/gcp/cloud-sql/common/monitors-cloud-sql-instance.tf rename to cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf diff --git a/cloud/gcp/cloud-sql/mysql/README.md b/cloud/gcp/cloud-sql/mysql/README.md index c1979b5..9af6c43 100644 --- a/cloud/gcp/cloud-sql/mysql/README.md +++ b/cloud/gcp/cloud-sql/mysql/README.md @@ -16,8 +16,6 @@ module "datadog-monitors-cloud-gcp-cloud-sql-mysql" { Creates DataDog monitors with the following checks: -- Cloud SQL MySQL Queries Count changed abnormally -- Cloud SQL MySQL Questions Count changed abnormally - Cloud SQL MySQL Replication Lag ## Inputs @@ -29,36 +27,6 @@ Creates DataDog monitors with the following checks: | filter_tags | Tags used for filtering | string | `*` | no | | message | Message sent when a monitor is triggered | string | - | yes | | new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no | -| queries_changing_anomaly_alert_window | Alert window. | string | `last_30m` | no | -| queries_changing_anomaly_count_default_zero | Count default zero. | string | `false` | no | -| queries_changing_anomaly_detection_algorithm | Anomaly Detection Algorithm used | string | `agile` | no | -| queries_changing_anomaly_deviations | Deviations to detect the anomaly | string | `4` | no | -| queries_changing_anomaly_direction | Direction of the anomaly. It can be both, below or above. | string | `both` | no | -| queries_changing_anomaly_extra_tags | Extra tags for GCP Cloud SQL Queries Changing monitor | list | `` | no | -| queries_changing_anomaly_interval | Interval. | string | `20` | no | -| queries_changing_anomaly_message | Custom message for the Queries Changing monitor | string | `` | no | -| queries_changing_anomaly_seasonality | Seasonality of the algorithm | string | `weekly` | no | -| queries_changing_anomaly_silenced | Groups to mute for GCP Cloud SQL Queries Changing monitor | map | `` | no | -| queries_changing_anomaly_threshold_critical | Queries Changing critical threshold | string | `1` | no | -| queries_changing_anomaly_threshold_critical_recovery | Queries Changing critical recovery threshold | string | `0.99` | no | -| queries_changing_anomaly_threshold_warning | Queries Changing warning threshold | string | `0.5` | no | -| queries_changing_anomaly_time_aggregator | Time aggregator for the Queries Changing mon monitor | string | `avg` | no | -| queries_changing_anomaly_timeframe | Timeframe for the Queries Changing mon monitor | string | `last_1h` | no | -| questions_changing_anomaly_alert_window | Alert window. | string | `last_30m` | no | -| questions_changing_anomaly_count_default_zero | Count default zero. | string | `false` | no | -| questions_changing_anomaly_detection_algorithm | Anomaly Detection Algorithm used | string | `agile` | no | -| questions_changing_anomaly_deviations | Deviations to detect the anomaly | string | `4` | no | -| questions_changing_anomaly_direction | Direction of the anomaly. It can be both, below or above. | string | `both` | no | -| questions_changing_anomaly_extra_tags | Extra tags for GCP Cloud SQL Questions Changing monitor | list | `` | no | -| questions_changing_anomaly_interval | Interval. | string | `20` | no | -| questions_changing_anomaly_message | Custom message for the Questions Changing monitor | string | `` | no | -| questions_changing_anomaly_seasonality | Seasonality of the algorithm | string | `weekly` | no | -| questions_changing_anomaly_silenced | Groups to mute for GCP Cloud SQL Questions Changing monitor | map | `` | no | -| questions_changing_anomaly_threshold_critical | Questions Changing critical threshold | string | `1` | no | -| questions_changing_anomaly_threshold_critical_recovery | Questions Changing critical recovery threshold | string | `0.99` | no | -| questions_changing_anomaly_threshold_warning | Questions Changing warning threshold | string | `0.5` | no | -| questions_changing_anomaly_time_aggregator | Time aggregator for the Questions Changing monitor | string | `avg` | no | -| questions_changing_anomaly_timeframe | Timeframe for the Questions Changing monitor | string | `last_1h` | no | | replication_lag_extra_tags | Extra tags for GCP Cloud SQL SQL Replication monitor | list | `` | no | | replication_lag_message | Custom message for the Replication Lag monitor | string | `` | no | | replication_lag_silenced | Groups to mute for GCP Cloud SQL Replication Lag monitor | map | `` | no | @@ -71,8 +39,6 @@ Creates DataDog monitors with the following checks: | Name | Description | |------|-------------| -| queries_changing_anomaly_id | id for monitor queries_changing_anomaly | -| questions_changing_anomaly_id | id for monitor questions_changing_anomaly | | replication_lag_id | id for monitor replication_lag | ## Related documentation diff --git a/cloud/gcp/cloud-sql/mysql/inputs.tf b/cloud/gcp/cloud-sql/mysql/inputs.tf index e065be7..0b3c567 100644 --- a/cloud/gcp/cloud-sql/mysql/inputs.tf +++ b/cloud/gcp/cloud-sql/mysql/inputs.tf @@ -70,191 +70,3 @@ variable "replication_lag_extra_tags" { type = "list" default = [] } - -# -# Queries Changing Abnormally -# - -variable "queries_changing_anomaly_message" { - description = "Custom message for the Queries Changing monitor" - type = "string" - default = "" -} - -variable "queries_changing_anomaly_time_aggregator" { - description = "Time aggregator for the Queries Changing mon monitor" - type = "string" - default = "avg" -} - -variable "queries_changing_anomaly_timeframe" { - description = "Timeframe for the Queries Changing mon monitor" - type = "string" - default = "last_1h" -} - -variable "queries_changing_anomaly_detection_algorithm" { - description = "Anomaly Detection Algorithm used" - type = "string" - default = "agile" -} - -variable "queries_changing_anomaly_deviations" { - description = "Deviations to detect the anomaly" - type = "string" - default = 4 -} - -variable "queries_changing_anomaly_direction" { - description = "Direction of the anomaly. It can be both, below or above." - type = "string" - default = "both" -} - -variable "queries_changing_anomaly_alert_window" { - description = "Alert window." - type = "string" - default = "last_30m" -} - -variable "queries_changing_anomaly_interval" { - description = "Interval." - type = "string" - default = 20 -} - -variable "queries_changing_anomaly_count_default_zero" { - description = "Count default zero." - type = "string" - default = "false" -} - -variable "queries_changing_anomaly_seasonality" { - description = "Seasonality of the algorithm" - type = "string" - default = "weekly" -} - -variable "queries_changing_anomaly_threshold_warning" { - description = "Queries Changing warning threshold" - type = "string" - default = 0.5 -} - -variable "queries_changing_anomaly_threshold_critical" { - description = "Queries Changing critical threshold" - type = "string" - default = 1 -} - -variable "queries_changing_anomaly_threshold_critical_recovery" { - description = "Queries Changing critical recovery threshold" - type = "string" - default = 0.99 -} - -variable "queries_changing_anomaly_silenced" { - description = "Groups to mute for GCP Cloud SQL Queries Changing monitor" - type = "map" - default = {} -} - -variable "queries_changing_anomaly_extra_tags" { - description = "Extra tags for GCP Cloud SQL Queries Changing monitor" - type = "list" - default = [] -} - -# -# Questions Changing -# - -variable "questions_changing_anomaly_message" { - description = "Custom message for the Questions Changing monitor" - type = "string" - default = "" -} - -variable "questions_changing_anomaly_time_aggregator" { - description = "Time aggregator for the Questions Changing monitor" - type = "string" - default = "avg" -} - -variable "questions_changing_anomaly_timeframe" { - description = "Timeframe for the Questions Changing monitor" - type = "string" - default = "last_1h" -} - -variable "questions_changing_anomaly_detection_algorithm" { - description = "Anomaly Detection Algorithm used" - type = "string" - default = "agile" -} - -variable "questions_changing_anomaly_alert_window" { - description = "Alert window." - type = "string" - default = "last_30m" -} - -variable "questions_changing_anomaly_interval" { - description = "Interval." - type = "string" - default = 20 -} - -variable "questions_changing_anomaly_count_default_zero" { - description = "Count default zero." - type = "string" - default = "false" -} - -variable "questions_changing_anomaly_deviations" { - description = "Deviations to detect the anomaly" - type = "string" - default = 4 -} - -variable "questions_changing_anomaly_direction" { - description = "Direction of the anomaly. It can be both, below or above." - type = "string" - default = "both" -} - -variable "questions_changing_anomaly_seasonality" { - description = "Seasonality of the algorithm" - type = "string" - default = "weekly" -} - -variable "questions_changing_anomaly_threshold_warning" { - description = "Questions Changing warning threshold" - type = "string" - default = 0.5 -} - -variable "questions_changing_anomaly_threshold_critical" { - description = "Questions Changing critical threshold" - type = "string" - default = 1 -} - -variable "questions_changing_anomaly_threshold_critical_recovery" { - description = "Questions Changing critical recovery threshold" - type = "string" - default = 0.99 -} - -variable "questions_changing_anomaly_silenced" { - description = "Groups to mute for GCP Cloud SQL Questions Changing monitor" - type = "map" - default = {} -} - -variable "questions_changing_anomaly_extra_tags" { - description = "Extra tags for GCP Cloud SQL Questions Changing monitor" - type = "list" - default = [] -} diff --git a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf index 02d7725..0e0fd1c 100644 --- a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf +++ b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf @@ -34,95 +34,3 @@ EOF tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", "${var.replication_lag_extra_tags}"] } - -# -# Queries Anomaly -# -resource "datadog_monitor" "queries_changing_anomaly" { - name = "[${var.environment}] Cloud SQL MySQL Queries Count changed abnormally" - message = "${coalesce(var.queries_changing_anomaly_message, var.message)}" - - type = "query alert" - - query = < ${var.queries_changing_anomaly_threshold_critical} -EOF - - thresholds { - warning = "${var.queries_changing_anomaly_threshold_warning}" - critical = "${var.queries_changing_anomaly_threshold_critical}" - critical_recovery = "${var.queries_changing_anomaly_threshold_critical_recovery}" - } - - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - silenced = "${var.queries_changing_anomaly_silenced}" - - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", "${var.queries_changing_anomaly_extra_tags}"] -} - -# -# Questions Anomaly -# -resource "datadog_monitor" "questions_changing_anomaly" { - name = "[${var.environment}] Cloud SQL MySQL Questions Count changed abnormally" - message = "${coalesce(var.questions_changing_anomaly_message, var.message)}" - - type = "query alert" - - query = < ${var.questions_changing_anomaly_threshold_critical} -EOF - - thresholds { - warning = "${var.questions_changing_anomaly_threshold_warning}" - critical = "${var.questions_changing_anomaly_threshold_critical}" - critical_recovery = "${var.questions_changing_anomaly_threshold_critical_recovery}" - } - - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - silenced = "${var.questions_changing_anomaly_silenced}" - - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", "${var.questions_changing_anomaly_extra_tags}"] -} diff --git a/cloud/gcp/cloud-sql/mysql/outputs.tf b/cloud/gcp/cloud-sql/mysql/outputs.tf index 77e2353..e8e24fd 100644 --- a/cloud/gcp/cloud-sql/mysql/outputs.tf +++ b/cloud/gcp/cloud-sql/mysql/outputs.tf @@ -2,13 +2,3 @@ output "replication_lag_id" { description = "id for monitor replication_lag" value = "${datadog_monitor.replication_lag.*.id}" } - -output "queries_changing_anomaly_id" { - description = "id for monitor queries_changing_anomaly" - value = "${datadog_monitor.queries_changing_anomaly.*.id}" -} - -output "questions_changing_anomaly_id" { - description = "id for monitor questions_changing_anomaly" - value = "${datadog_monitor.questions_changing_anomaly.*.id}" -}