MON-75 Add some descriptions and add EOF on queries
This commit is contained in:
parent
71d78bacde
commit
220dfe019d
@ -27,18 +27,19 @@ Creates a DataDog monitors with the following checks :
|
|||||||
Inputs
|
Inputs
|
||||||
------
|
------
|
||||||
|
|
||||||
| Name | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|:----:|:-------:|:--------:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
| client_name | Client name | string | - | yes |
|
| cpu_threshold_critical | CPU usage in percent (critical threshold) | string | `90` | no |
|
||||||
|
| cpu_threshold_warning | CPU usage in percent (warning threshold) | string | `` | no |
|
||||||
|
| deadlock_threshold_critical | Amount of Deadlocks (critical threshold) | string | `1` | no |
|
||||||
| delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
| delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
||||||
| environment | Architecture environment | string | - | yes |
|
| diskspace_threshold_critical | Disk space used in percent (critical threshold) | string | `90` | no |
|
||||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
| diskspace_threshold_warning | Disk space used in percent (warning threshold) | string | `80` | no |
|
||||||
| use_filter_tags | Filter the data with service tags if true | string | `false` | no |
|
| dtu_threshold_critical | Amount of DTU used (critical threshold) | string | `90` | no |
|
||||||
| dd_azure_sqldb | string | `disabled` | yes |
|
| dtu_threshold_warning | Amount of DTU used (warning threshold) | string | `85` | no |
|
||||||
| cpu_threshold_warning | string | `85` | no |
|
| environment | Architecture Environment | string | - | yes |
|
||||||
| cpu_threshold_critical | string | `90` | no |
|
| message | Message sent when an alert is triggered | string | - | yes |
|
||||||
| diskspace_threshold_warning | string | `80` | no |
|
| provider | Cloud provider which the monitor and its based metric depend on | string | `azure` | no |
|
||||||
| diskspace_threshold_critical | string | `90` | no |
|
| service | Service monitored by this set of monitors | string | `sql-database` | no |
|
||||||
| dtu_threshold_warning | string | `85` | no |
|
| subscription_id | Azure account id used as filter for monitors | string | - | yes |
|
||||||
| dtu_threshold_critical | string | `90` | no |
|
| use_filter_tags | Filter the data with service tags if true | string | `true` | no |
|
||||||
| deadlock_threshold_critical | string | `1` | no |
|
|
||||||
|
|||||||
@ -1,49 +1,74 @@
|
|||||||
|
# Global Terraform
|
||||||
|
variable "environment" {
|
||||||
|
description = "Architecture Environment"
|
||||||
|
type = "string"
|
||||||
|
}
|
||||||
|
|
||||||
variable "subscription_id" {
|
variable "subscription_id" {
|
||||||
default = ""
|
description = "Azure account id used as filter for monitors"
|
||||||
|
type = "string"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "provider" {
|
||||||
|
description = "Cloud provider which the monitor and its based metric depend on"
|
||||||
|
type = "string"
|
||||||
|
default = "azure"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "service" {
|
||||||
|
description = "Service monitored by this set of monitors"
|
||||||
|
type = "string"
|
||||||
|
default = "sql-database"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Global DataDog
|
||||||
|
variable "delay" {
|
||||||
|
description = "Delay in seconds for the metric evaluation"
|
||||||
|
default = 600
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "message" {
|
variable "message" {
|
||||||
description = "Message sent when a SQL DB monitor is triggered"
|
description = "Message sent when an alert is triggered"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment" {}
|
|
||||||
|
|
||||||
variable "use_filter_tags" {
|
variable "use_filter_tags" {
|
||||||
default = "false"
|
description = "Filter the data with service tags if true"
|
||||||
|
default = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Azure SQL Database specific
|
||||||
|
|
||||||
variable "cpu_threshold_warning" {
|
variable "cpu_threshold_warning" {
|
||||||
default = ""
|
description = "CPU usage in percent (warning threshold)"
|
||||||
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cpu_threshold_critical" {
|
variable "cpu_threshold_critical" {
|
||||||
default = "90"
|
description = "CPU usage in percent (critical threshold)"
|
||||||
|
default = "90"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "diskspace_threshold_warning" {
|
variable "diskspace_threshold_warning" {
|
||||||
default = "80"
|
description = "Disk space used in percent (warning threshold)"
|
||||||
|
default = "80"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "diskspace_threshold_critical" {
|
variable "diskspace_threshold_critical" {
|
||||||
default = "90"
|
description = "Disk space used in percent (critical threshold)"
|
||||||
|
default = "90"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dtu_threshold_warning" {
|
variable "dtu_threshold_warning" {
|
||||||
default = "85"
|
description = "Amount of DTU used (warning threshold)"
|
||||||
|
default = "85"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "dtu_threshold_critical" {
|
variable "dtu_threshold_critical" {
|
||||||
default = "90"
|
description = "Amount of DTU used (critical threshold)"
|
||||||
|
default = "90"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "deadlock_threshold_critical" {
|
variable "deadlock_threshold_critical" {
|
||||||
default = "1"
|
description = "Amount of Deadlocks (critical threshold)"
|
||||||
}
|
default = "1"
|
||||||
|
|
||||||
variable "delay" {
|
|
||||||
default = "600"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "dd_azure_sqldb" {
|
|
||||||
default = "disabled"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,10 +10,13 @@ resource "datadog_monitor" "sql-database_cpu_90_15min" {
|
|||||||
name = "[${var.environment}] SQL Database CPU high > 90% for 15 min on {{name}}"
|
name = "[${var.environment}] SQL Database CPU high > 90% for 15 min on {{name}}"
|
||||||
message = "${message}"
|
message = "${message}"
|
||||||
|
|
||||||
count = "${var.dd_azure_sqldb == "enabled" ? 1 : 0 }"
|
query = <<EOF
|
||||||
|
avg(last_15m): (
|
||||||
|
avg:azure.sql_servers_databases.cpu_percent{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||||
|
) > ${var.cpu_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
query = "avg(last_15m):avg:azure.sql_servers_databases.cpu_percent{${data.template_file.filter.rendered}} by {name,resource_group} > ${var.cpu_threshold_critical}"
|
type = "query alert"
|
||||||
type = "query alert"
|
|
||||||
|
|
||||||
thresholds {
|
thresholds {
|
||||||
critical = "${var.cpu_threshold_critical}"
|
critical = "${var.cpu_threshold_critical}"
|
||||||
@ -35,10 +38,13 @@ resource "datadog_monitor" "sql-database_free_space_low" {
|
|||||||
name = "[${var.environment}] SQL Database free space < 10 % on {{name}}"
|
name = "[${var.environment}] SQL Database free space < 10 % on {{name}}"
|
||||||
message = "${message}"
|
message = "${message}"
|
||||||
|
|
||||||
type = "query alert"
|
type = "query alert"
|
||||||
query = "avg(last_15m):avg:azure.sql_servers_databases.storage_percent{${data.template_file.filter.rendered}} by {name,resource_group} > 90"
|
|
||||||
|
|
||||||
count = "${var.dd_azure_sqldb == "enabled" ? 1 : 0 }"
|
query = <<EOF
|
||||||
|
avg(last_15m): (
|
||||||
|
avg:azure.sql_servers_databases.storage_percent{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||||
|
) > ${var.diskspace_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
thresholds {
|
thresholds {
|
||||||
warning = "${var.diskspace_threshold_warning}"
|
warning = "${var.diskspace_threshold_warning}"
|
||||||
@ -61,10 +67,13 @@ resource "datadog_monitor" "sql-database_dtu_consumption_high" {
|
|||||||
name = "[${var.environment}] DTU Consumption on {{name}} > 90"
|
name = "[${var.environment}] DTU Consumption on {{name}} > 90"
|
||||||
message = "${message}"
|
message = "${message}"
|
||||||
|
|
||||||
type = "query alert"
|
type = "query alert"
|
||||||
query = "avg(last_15m):azure.sql_servers_databases.dtu_consumption_percent{${data.template_file.filter.rendered}} by {name,resource_group} > 90"
|
|
||||||
|
|
||||||
count = "${var.dd_azure_sqldb == "enabled" ? 1 : 0 }"
|
query = <<EOF
|
||||||
|
avg(last_15m): (
|
||||||
|
azure.sql_servers_databases.dtu_consumption_percent{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||||
|
) > ${var.dtu_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
thresholds {
|
thresholds {
|
||||||
warning = "${var.dtu_threshold_warning}"
|
warning = "${var.dtu_threshold_warning}"
|
||||||
@ -87,10 +96,13 @@ resource "datadog_monitor" "sql-database_deadlocks_count" {
|
|||||||
name = "[${var.environment}] SQL Deadlocks too high on {{name}}"
|
name = "[${var.environment}] SQL Deadlocks too high on {{name}}"
|
||||||
message = "${message}"
|
message = "${message}"
|
||||||
|
|
||||||
type = "query alert"
|
type = "query alert"
|
||||||
query = "sum(last_5m):avg:azure.sql_servers_databases.deadlock{${data.template_file.filter.rendered}} by {name,resource_group}.as_count() > ${var.deadlock_threshold_critical}"
|
|
||||||
|
|
||||||
count = "${var.dd_azure_sqldb == "enabled" ? 1 : 0 }"
|
query = <<EOF
|
||||||
|
sum(last_5m): (
|
||||||
|
avg:azure.sql_servers_databases.deadlock{${data.template_file.filter.rendered}} by {name,resource_group}.as_count()
|
||||||
|
) > ${var.deadlock_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
thresholds {
|
thresholds {
|
||||||
critical = "${var.deadlock_threshold_critical}"
|
critical = "${var.deadlock_threshold_critical}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user