Merge branch 'MON-331_improve_mysql_throughput' into 'master'

MON-331 use questions instead of queries to only see client activity

Closes MON-331

See merge request claranet/pt-monitoring/projects/datadog/terraform/monitors!48
This commit is contained in:
Quentin Manfroi 2019-04-23 17:22:48 +02:00
commit 5b95fc0f26
4 changed files with 49 additions and 49 deletions

View File

@ -73,20 +73,20 @@ Creates DataDog monitors with the following checks:
| mysql\_pool\_utilization\_threshold\_warning | Maximum warning acceptable percent of innodb buffer pool utilization | string | `"80"` | no |
| mysql\_pool\_utilization\_time\_aggregator | Monitor time aggregator for MySQL innodb buffer pool utilization monitor [available values: min, max or avg] | string | `"min"` | no |
| mysql\_pool\_utilization\_timeframe | Monitor timeframe for MySQL innodb buffer pool utilization monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_1h"` | no |
| mysql\_queries\_alert\_window | Alert window. | string | `"last_15m"` | no |
| mysql\_queries\_count\_default\_zero | Count default zero. | string | `"true"` | no |
| mysql\_queries\_detection\_algorithm | Anomaly Detection Algorithm used | string | `"agile"` | no |
| mysql\_queries\_deviations | Deviations to detect the anomaly | string | `"5"` | no |
| mysql\_queries\_direction | Direction of the anomaly. It can be both, below or above. | string | `"both"` | no |
| mysql\_queries\_enabled | Flag to enable mysql queries monitor | string | `"true"` | no |
| mysql\_queries\_extra\_tags | Extra tags for MySQL queries monitor | list | `[]` | no |
| mysql\_queries\_interval | Interval. | string | `"60"` | no |
| mysql\_queries\_message | Custom message for MySQL queries monitor | string | `""` | no |
| mysql\_queries\_seasonality | Seasonality of the algorithm | string | `"daily"` | no |
| mysql\_queries\_silenced | Groups to mute for mysql queries monitor | map | `{}` | no |
| mysql\_queries\_threshold\_critical | Maximum critical acceptable number of queries | string | `"1"` | no |
| mysql\_queries\_time\_aggregator | Monitor time aggregator for MySQL queries monitor [available values: min, max or avg] | string | `"avg"` | no |
| mysql\_queries\_timeframe | Monitor timeframe for MySQL queries monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_4h"` | no |
| mysql\_questions\_alert\_window | Alert window. | string | `"last_15m"` | no |
| mysql\_questions\_count\_default\_zero | Count default zero. | string | `"true"` | no |
| mysql\_questions\_detection\_algorithm | Anomaly Detection Algorithm used | string | `"agile"` | no |
| mysql\_questions\_deviations | Deviations to detect the anomaly | string | `"5"` | no |
| mysql\_questions\_direction | Direction of the anomaly. It can be both, below or above. | string | `"both"` | no |
| mysql\_questions\_enabled | Flag to enable mysql queries monitor | string | `"true"` | no |
| mysql\_questions\_extra\_tags | Extra tags for MySQL queries monitor | list | `[]` | no |
| mysql\_questions\_interval | Interval. | string | `"60"` | no |
| mysql\_questions\_message | Custom message for MySQL queries monitor | string | `""` | no |
| mysql\_questions\_seasonality | Seasonality of the algorithm | string | `"daily"` | no |
| mysql\_questions\_silenced | Groups to mute for mysql queries monitor | map | `{}` | no |
| mysql\_questions\_threshold\_critical | Maximum critical acceptable number of queries | string | `"1"` | no |
| mysql\_questions\_time\_aggregator | Monitor time aggregator for MySQL queries monitor [available values: min, max or avg] | string | `"avg"` | no |
| mysql\_questions\_timeframe | Monitor timeframe for MySQL queries monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_4h"` | no |
| mysql\_slow\_enabled | Flag to enable MySQL slow queries monitor | string | `"true"` | no |
| mysql\_slow\_extra\_tags | Extra tags for MySQL slow queries monitor | list | `[]` | no |
| mysql\_slow\_message | Custom message for MySQL slow queries monitor | string | `""` | no |
@ -120,7 +120,7 @@ Creates DataDog monitors with the following checks:
| mysql\_connection\_id | id for monitor mysql_connection |
| mysql\_pool\_efficiency\_id | id for monitor mysql_pool_efficiency |
| mysql\_pool\_utilization\_id | id for monitor mysql_pool_utilization |
| mysql\_queries\_anomaly\_id | id for monitor mysql_queries_anomaly |
| mysql\_questions\_anomaly\_id | id for monitor mysql_questions_anomaly |
| mysql\_slow\_id | id for monitor mysql_slow |
| mysql\_threads\_anomaly\_id | id for monitor mysql_threads_anomaly |

View File

@ -415,84 +415,84 @@ variable "mysql_threads_timeframe" {
### MySQL queries ###
#################################
variable "mysql_queries_silenced" {
variable "mysql_questions_silenced" {
description = "Groups to mute for mysql queries monitor"
type = "map"
default = {}
}
variable "mysql_queries_enabled" {
variable "mysql_questions_enabled" {
description = "Flag to enable mysql queries monitor"
type = "string"
default = "true"
}
variable "mysql_queries_extra_tags" {
variable "mysql_questions_extra_tags" {
description = "Extra tags for MySQL queries monitor"
type = "list"
default = []
}
variable "mysql_queries_message" {
variable "mysql_questions_message" {
description = "Custom message for MySQL queries monitor"
type = "string"
default = ""
}
variable "mysql_queries_threshold_critical" {
variable "mysql_questions_threshold_critical" {
default = 1
description = "Maximum critical acceptable number of queries"
}
variable "mysql_queries_detection_algorithm" {
variable "mysql_questions_detection_algorithm" {
description = "Anomaly Detection Algorithm used"
type = "string"
default = "agile"
}
variable "mysql_queries_deviations" {
variable "mysql_questions_deviations" {
description = "Deviations to detect the anomaly"
type = "string"
default = 5
}
variable "mysql_queries_direction" {
variable "mysql_questions_direction" {
description = "Direction of the anomaly. It can be both, below or above."
type = "string"
default = "both"
}
variable "mysql_queries_alert_window" {
variable "mysql_questions_alert_window" {
description = "Alert window."
type = "string"
default = "last_15m"
}
variable "mysql_queries_interval" {
variable "mysql_questions_interval" {
description = "Interval."
type = "string"
default = 60
}
variable "mysql_queries_count_default_zero" {
variable "mysql_questions_count_default_zero" {
description = "Count default zero."
type = "string"
default = "true"
}
variable "mysql_queries_seasonality" {
variable "mysql_questions_seasonality" {
description = "Seasonality of the algorithm"
type = "string"
default = "daily"
}
variable "mysql_queries_time_aggregator" {
variable "mysql_questions_time_aggregator" {
description = "Monitor time aggregator for MySQL queries monitor [available values: min, max or avg]"
type = "string"
default = "avg"
}
variable "mysql_queries_timeframe" {
variable "mysql_questions_timeframe" {
description = "Monitor timeframe for MySQL queries monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = "string"
default = "last_4h"

View File

@ -206,7 +206,7 @@ resource "datadog_monitor" "mysql_threads_anomaly" {
alert_window='${var.mysql_threads_alert_window}',
interval=${var.mysql_threads_interval},
count_default_zero='${var.mysql_threads_count_default_zero}'
${var.mysql_threads_seasonality == "agile" ? format(",seasonality='%s'", var.mysql_queries_seasonality): ""}
${var.mysql_threads_seasonality == "agile" ? format(",seasonality='%s'", var.mysql_threads_seasonality): ""}
)
>= ${var.mysql_threads_threshold_critical}
EOF
@ -230,32 +230,32 @@ resource "datadog_monitor" "mysql_threads_anomaly" {
tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_threads_extra_tags}"]
}
resource "datadog_monitor" "mysql_queries_anomaly" {
count = "${var.mysql_queries_enabled ? 1 : 0}"
resource "datadog_monitor" "mysql_questions_anomaly" {
count = "${var.mysql_questions_enabled ? 1 : 0}"
name = "[${var.environment}] Mysql queries changed abnormally"
message = "${coalesce(var.mysql_queries_message, var.message)}"
message = "${coalesce(var.mysql_questions_message, var.message)}"
type = "metric alert"
query = <<EOF
${var.mysql_queries_time_aggregator}(${var.mysql_queries_timeframe}):
${var.mysql_questions_time_aggregator}(${var.mysql_questions_timeframe}):
anomalies(
avg:mysql.performance.queries${module.filter-tags.query_alert} by {server},
'${var.mysql_queries_detection_algorithm}',
${var.mysql_queries_deviations},
direction='${var.mysql_queries_direction}',
alert_window='${var.mysql_queries_alert_window}',
interval=${var.mysql_queries_interval},
count_default_zero='${var.mysql_queries_count_default_zero}'
${var.mysql_queries_detection_algorithm == "agile" ? format(",seasonality='%s'", var.mysql_queries_seasonality): ""}
avg:mysql.performance.questions${module.filter-tags.query_alert} by {server},
'${var.mysql_questions_detection_algorithm}',
${var.mysql_questions_deviations},
direction='${var.mysql_questions_direction}',
alert_window='${var.mysql_questions_alert_window}',
interval=${var.mysql_questions_interval},
count_default_zero='${var.mysql_questions_count_default_zero}'
${var.mysql_questions_detection_algorithm == "agile" ? format(",seasonality='%s'", var.mysql_questions_seasonality): ""}
)
>= ${var.mysql_queries_threshold_critical}
>= ${var.mysql_questions_threshold_critical}
EOF
evaluation_delay = "${var.evaluation_delay}"
new_host_delay = "${var.new_host_delay}"
thresholds {
critical = "${var.mysql_queries_threshold_critical}"
critical = "${var.mysql_questions_threshold_critical}"
critical_recovery = 0
}
@ -265,7 +265,7 @@ resource "datadog_monitor" "mysql_queries_anomaly" {
timeout_h = 0
include_tags = true
silenced = "${var.mysql_queries_silenced}"
silenced = "${var.mysql_questions_silenced}"
tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_queries_extra_tags}"]
tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_questions_extra_tags}"]
}

View File

@ -33,7 +33,7 @@ output "mysql_threads_anomaly_id" {
value = "${datadog_monitor.mysql_threads_anomaly.*.id}"
}
output "mysql_queries_anomaly_id" {
description = "id for monitor mysql_queries_anomaly"
value = "${datadog_monitor.mysql_queries_anomaly.*.id}"
output "mysql_questions_anomaly_id" {
description = "id for monitor mysql_questions_anomaly"
value = "${datadog_monitor.mysql_questions_anomaly.*.id}"
}