MON-246 - compute consumption monitor added
This commit is contained in:
parent
db30561ccd
commit
bdfb100cbc
@ -16,6 +16,7 @@ module "datadog-monitors-cloud-azure-mysql" {
|
|||||||
|
|
||||||
Creates DataDog monitors with the following checks:
|
Creates DataDog monitors with the following checks:
|
||||||
|
|
||||||
|
- Mysql Server compute consumption is high
|
||||||
- Mysql Server CPU usage is high
|
- Mysql Server CPU usage is high
|
||||||
- Mysql Server has no connection
|
- Mysql Server has no connection
|
||||||
- Mysql Server IO consumption is high
|
- Mysql Server IO consumption is high
|
||||||
@ -26,6 +27,12 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|:----:|:-----:|:-----:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
|
| compute_consumption_message | Custom message for Mysql compute consumption monitor | string | `` | no |
|
||||||
|
| compute_consumption_silenced | Groups to mute for Mysql compute consumption monitor | map | `{}` | no |
|
||||||
|
| compute_consumption_threshold_critical | Mysql compute consumption in percent (critical threshold) | string | `90` | no |
|
||||||
|
| compute_consumption_threshold_warning | Mysql compute consumption in percent (warning threshold) | string | `80` | no |
|
||||||
|
| compute_consumption_time_aggregator | Monitor aggregator for Mysql compute consumption [available values: min, max or avg] | string | `min` | no |
|
||||||
|
| compute_consumption_timeframe | Monitor timeframe for Mysql compute consumption [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no |
|
||||||
| cpu_usage_message | Custom message for Mysql CPU monitor | string | `` | no |
|
| cpu_usage_message | Custom message for Mysql CPU monitor | string | `` | no |
|
||||||
| cpu_usage_silenced | Groups to mute for Mysql CPU monitor | map | `{}` | no |
|
| cpu_usage_silenced | Groups to mute for Mysql CPU monitor | map | `{}` | no |
|
||||||
| cpu_usage_threshold_critical | Mysql CPU usage in percent (critical threshold) | string | `90` | no |
|
| cpu_usage_threshold_critical | Mysql CPU usage in percent (critical threshold) | string | `90` | no |
|
||||||
@ -64,6 +71,7 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
|
| mysql_compute_consumption_id | id for monitor mysql_compute_consumption |
|
||||||
| mysql_cpu_usage_id | id for monitor mysql_cpu_usage |
|
| mysql_cpu_usage_id | id for monitor mysql_cpu_usage |
|
||||||
| mysql_free_storage_id | id for monitor mysql_free_storage |
|
| mysql_free_storage_id | id for monitor mysql_free_storage |
|
||||||
| mysql_io_consumption_id | id for monitor mysql_io_consumption |
|
| mysql_io_consumption_id | id for monitor mysql_io_consumption |
|
||||||
|
|||||||
@ -151,6 +151,40 @@ variable "io_consumption_threshold_critical" {
|
|||||||
default = "90"
|
default = "90"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_silenced" {
|
||||||
|
description = "Groups to mute for Mysql compute consumption monitor"
|
||||||
|
type = "map"
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_message" {
|
||||||
|
description = "Custom message for Mysql compute consumption monitor"
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_time_aggregator" {
|
||||||
|
description = "Monitor aggregator for Mysql compute consumption [available values: min, max or avg]"
|
||||||
|
type = "string"
|
||||||
|
default = "min"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_timeframe" {
|
||||||
|
description = "Monitor timeframe for Mysql compute consumption [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||||
|
type = "string"
|
||||||
|
default = "last_15m"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_threshold_warning" {
|
||||||
|
description = "Mysql compute consumption in percent (warning threshold)"
|
||||||
|
default = "80"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "compute_consumption_threshold_critical" {
|
||||||
|
description = "Mysql compute consumption in percent (critical threshold)"
|
||||||
|
default = "90"
|
||||||
|
}
|
||||||
|
|
||||||
variable "memory_usage_silenced" {
|
variable "memory_usage_silenced" {
|
||||||
description = "Groups to mute for Mysql memory monitor"
|
description = "Groups to mute for Mysql memory monitor"
|
||||||
type = "map"
|
type = "map"
|
||||||
|
|||||||
@ -129,6 +129,38 @@ resource "datadog_monitor" "mysql_io_consumption" {
|
|||||||
tags = ["env:${var.environment}", "resource:mysql", "team:azure", "provider:azure"]
|
tags = ["env:${var.environment}", "resource:mysql", "team:azure", "provider:azure"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "mysql_compute_consumption" {
|
||||||
|
name = "[${var.environment}] Mysql Server compute consumption is high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
||||||
|
message = "${coalesce(var.compute_consumption_message, var.message)}"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
${var.compute_consumption_time_aggregator}(${var.compute_consumption_timeframe}): (
|
||||||
|
avg:azure.dbformysql_servers.compute_consumption_percent{${data.template_file.filter.rendered}} by {resource_group,region,name}
|
||||||
|
) > ${var.compute_consumption_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
critical = "${var.compute_consumption_threshold_critical}"
|
||||||
|
warning = "${var.compute_consumption_threshold_warning}"
|
||||||
|
}
|
||||||
|
|
||||||
|
silenced = "${var.compute_consumption_silenced}"
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
evaluation_delay = "${var.delay}"
|
||||||
|
renotify_interval = 0
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = false
|
||||||
|
new_host_delay = "${var.delay}"
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "resource:mysql", "team:azure", "provider:azure"]
|
||||||
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "mysql_memory_usage" {
|
resource "datadog_monitor" "mysql_memory_usage" {
|
||||||
name = "[${var.environment}] Mysql Server memory usage is high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
name = "[${var.environment}] Mysql Server memory usage is high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
||||||
message = "${coalesce(var.memory_usage_message, var.message)}"
|
message = "${coalesce(var.memory_usage_message, var.message)}"
|
||||||
|
|||||||
@ -18,6 +18,11 @@ output "mysql_io_consumption_id" {
|
|||||||
value = "${datadog_monitor.mysql_io_consumption.*.id}"
|
value = "${datadog_monitor.mysql_io_consumption.*.id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "mysql_compute_consumption_id" {
|
||||||
|
description = "id for monitor mysql_compute_consumption"
|
||||||
|
value = "${datadog_monitor.mysql_compute_consumption.*.id}"
|
||||||
|
}
|
||||||
|
|
||||||
output "mysql_memory_usage_id" {
|
output "mysql_memory_usage_id" {
|
||||||
description = "id for monitor mysql_memory_usage"
|
description = "id for monitor mysql_memory_usage"
|
||||||
value = "${datadog_monitor.mysql_memory_usage.*.id}"
|
value = "${datadog_monitor.mysql_memory_usage.*.id}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user