MON-224 delete duplicated monitors from mysql
This commit is contained in:
parent
034336a07c
commit
75c9350667
@ -16,8 +16,6 @@ module "datadog-monitors-cloud-gcp-cloud-sql-mysql" {
|
|||||||
|
|
||||||
Creates DataDog monitors with the following checks:
|
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
|
- Cloud SQL MySQL Replication Lag
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
@ -29,36 +27,6 @@ Creates DataDog monitors with the following checks:
|
|||||||
| filter_tags | Tags used for filtering | string | `*` | no |
|
| filter_tags | Tags used for filtering | string | `*` | no |
|
||||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
| message | Message sent when a monitor is triggered | string | - | yes |
|
||||||
| new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no |
|
| 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 | `<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 | `<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 | `<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 | `<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 | `<list>` | no |
|
| replication_lag_extra_tags | Extra tags for GCP Cloud SQL SQL Replication monitor | list | `<list>` | no |
|
||||||
| replication_lag_message | Custom message for the Replication Lag monitor | string | `` | 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 | `<map>` | no |
|
| replication_lag_silenced | Groups to mute for GCP Cloud SQL Replication Lag monitor | map | `<map>` | no |
|
||||||
@ -71,8 +39,6 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
| Name | Description |
|
| 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 |
|
| replication_lag_id | id for monitor replication_lag |
|
||||||
|
|
||||||
## Related documentation
|
## Related documentation
|
||||||
|
|||||||
@ -70,191 +70,3 @@ variable "replication_lag_extra_tags" {
|
|||||||
type = "list"
|
type = "list"
|
||||||
default = []
|
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 = []
|
|
||||||
}
|
|
||||||
|
|||||||
@ -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}"]
|
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 = <<EOF
|
|
||||||
${var.queries_changing_anomaly_time_aggregator}(${var.queries_changing_anomaly_timeframe}):
|
|
||||||
anomalies(
|
|
||||||
avg:gcp.cloudsql.database.mysql.queries{${var.filter_tags}} by {database_id}.as_count(),
|
|
||||||
'${var.queries_changing_anomaly_detection_algorithm}',
|
|
||||||
${var.queries_changing_anomaly_deviations},
|
|
||||||
direction='${var.queries_changing_anomaly_direction}',
|
|
||||||
alert_window='${var.queries_changing_anomaly_alert_window}',
|
|
||||||
interval=${var.queries_changing_anomaly_interval},
|
|
||||||
count_default_zero='${var.queries_changing_anomaly_count_default_zero}',
|
|
||||||
seasonality='${var.queries_changing_anomaly_seasonality}'
|
|
||||||
)
|
|
||||||
> ${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 = <<EOF
|
|
||||||
${var.questions_changing_anomaly_time_aggregator}(${var.questions_changing_anomaly_timeframe}):
|
|
||||||
anomalies(
|
|
||||||
avg:gcp.cloudsql.database.mysql.questions{${var.filter_tags}} by {database_id},
|
|
||||||
'${var.questions_changing_anomaly_detection_algorithm}',
|
|
||||||
${var.questions_changing_anomaly_deviations},
|
|
||||||
direction='${var.questions_changing_anomaly_direction}',
|
|
||||||
alert_window='${var.questions_changing_anomaly_alert_window}',
|
|
||||||
interval=${var.questions_changing_anomaly_interval},
|
|
||||||
count_default_zero='${var.questions_changing_anomaly_count_default_zero}',
|
|
||||||
seasonality='${var.questions_changing_anomaly_seasonality}'
|
|
||||||
)
|
|
||||||
> ${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}"]
|
|
||||||
}
|
|
||||||
|
|||||||
@ -2,13 +2,3 @@ output "replication_lag_id" {
|
|||||||
description = "id for monitor replication_lag"
|
description = "id for monitor replication_lag"
|
||||||
value = "${datadog_monitor.replication_lag.*.id}"
|
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}"
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user