MON-316 Add threshold warning/critical for memory and cpu percentage

This commit is contained in:
jnancel 2018-09-28 10:37:03 +02:00 committed by Quentin Manfroi
parent 6f1e9a2246
commit 582b6a92d8
2 changed files with 32 additions and 2 deletions

View File

@ -105,6 +105,16 @@ variable "cpu_percentage_timeframe" {
default = "last_5m"
}
variable "cpu_percentage_threshold_critical" {
description = "CPU percentage (critical threshold)"
default = 80
}
variable "cpu_percentage_threshold_warning" {
description = "CPU percentage (warning threshold)"
default = 60
}
# Memory percentage
variable "memory_percentage_enabled" {
description = "Flag to enable the serverfarms memory_percentage monitor"
@ -141,3 +151,13 @@ variable "memory_percentage_timeframe" {
type = "string"
default = "last_5m"
}
variable "memory_percentage_threshold_critical" {
description = "Memory percentage (critical threshold)"
default = 80
}
variable "memory_percentage_threshold_warning" {
description = "Memory percentage (warning threshold)"
default = 60
}

View File

@ -34,11 +34,16 @@ resource "datadog_monitor" "cpu_percentage" {
query = <<EOF
${var.cpu_percentage_time_aggregator}(${var.cpu_percentage_timeframe}): (
avg:azure.web_serverfarms.cpu_percentage${module.filter-tags.query_alert} by {resource_group,region,name}
) != 1
) > ${var.cpu_percentage_threshold_critical}
EOF
type = "metric alert"
thresholds {
warning = "${var.cpu_percentage_threshold_warning}"
critical = "${var.cpu_percentage_threshold_critical}"
}
silenced = "${var.cpu_percentage_silenced}"
notify_no_data = true
@ -62,11 +67,16 @@ resource "datadog_monitor" "memory_percentage" {
query = <<EOF
${var.memory_percentage_time_aggregator}(${var.memory_percentage_timeframe}): (
avg:azure.web_serverfarms.memory_percentage${module.filter-tags.query_alert} by {resource_group,region,name}
) != 1
) > ${var.memory_percentage_threshold_critical}
EOF
type = "metric alert"
thresholds {
warning = "${var.memory_percentage_threshold_warning}"
critical = "${var.memory_percentage_threshold_critical}"
}
silenced = "${var.memory_percentage_silenced}"
notify_no_data = true