From 5357ef68e0f99b47849d833880d7cae0d1745126 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 20 Sep 2018 15:53:28 +0200 Subject: [PATCH] MON-32 add variables for eviction --- cloud/aws/elasticache/common/inputs.tf | 20 ++++++++++++------- .../common/monitors-elasticache.tf | 9 +++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cloud/aws/elasticache/common/inputs.tf b/cloud/aws/elasticache/common/inputs.tf index 9c9600b..84aaac0 100644 --- a/cloud/aws/elasticache/common/inputs.tf +++ b/cloud/aws/elasticache/common/inputs.tf @@ -54,16 +54,22 @@ variable "eviction_message" { default = "" } -variable "eviction_time_aggregator" { - description = "Monitor aggregator for Elasticache eviction [available values: min, max or avg]" - type = "string" - default = "min" -} - 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`]" 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" { diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 2296b4c..2a908e5 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -6,11 +6,16 @@ resource "datadog_monitor" "elasticache_eviction" { type = "metric alert" query = < 0 + ) > ${var.eviction_threshold_critical} EOF + thresholds { + warning = "${var.eviction_threshold_warning}" + critical = "${var.eviction_threshold_critical}" + } + notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0