MON-32 add variables for eviction

This commit is contained in:
Quentin Manfroi 2018-09-20 15:53:28 +02:00
parent d8bfbe086d
commit 5357ef68e0
2 changed files with 20 additions and 9 deletions

View File

@ -54,16 +54,22 @@ variable "eviction_message" {
default = "" default = ""
} }
variable "eviction_time_aggregator" {
description = "Monitor aggregator for Elasticache eviction [available values: min, max or avg]"
type = "string"
default = "min"
}
variable "eviction_timeframe" { variable "eviction_timeframe" {
description = "Monitor timeframe for Elasticache eviction [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" description = "Monitor timeframe for Elasticache eviction [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = "string" type = "string"
default = "last_5m" default = "last_15m"
}
variable "eviction_threshold_warning" {
description = "Elasticache free memory warning threshold in percentage"
type = "string"
default = 0
}
variable "eviction_threshold_critical" {
description = "Elasticache free memory critical threshold in percentage"
type = "string"
default = 30
} }
variable "max_connection_silenced" { variable "max_connection_silenced" {

View File

@ -6,11 +6,16 @@ resource "datadog_monitor" "elasticache_eviction" {
type = "metric alert" type = "metric alert"
query = <<EOF query = <<EOF
${var.eviction_time_aggregator}(${var.eviction_timeframe}): ( sum(${var.eviction_timeframe}): (
avg:aws.elasticache.evictions${module.filter-tags.query_alert} by {region,cacheclusterid} avg:aws.elasticache.evictions${module.filter-tags.query_alert} by {region,cacheclusterid}
) > 0 ) > ${var.eviction_threshold_critical}
EOF EOF
thresholds {
warning = "${var.eviction_threshold_warning}"
critical = "${var.eviction_threshold_critical}"
}
notify_no_data = false notify_no_data = false
evaluation_delay = "${var.evaluation_delay}" evaluation_delay = "${var.evaluation_delay}"
renotify_interval = 0 renotify_interval = 0