From 4a1c0261be93008483e9dee1afaeae0ba7cae76b Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Fri, 8 Jun 2018 11:25:05 +0200 Subject: [PATCH] MON-32 - CPU Redis monitors updated with new metric --- .../common/monitors-elasticache.tf | 1 + cloud/aws/elasticache/redis/locals.tf | 27 ------------------- cloud/aws/elasticache/redis/monitors-redis.tf | 8 +++--- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 cloud/aws/elasticache/redis/locals.tf diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 91f6287..0e83633 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -111,6 +111,7 @@ resource "datadog_monitor" "elasticache_swap" { tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] } +# POC - A approfondir resource "datadog_monitor" "redis_free_memory" { name = "[${var.environment}] Elasticache ${var.resource} free memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.free_memory_message, var.message)}" diff --git a/cloud/aws/elasticache/redis/locals.tf b/cloud/aws/elasticache/redis/locals.tf deleted file mode 100644 index 9d7a1eb..0000000 --- a/cloud/aws/elasticache/redis/locals.tf +++ /dev/null @@ -1,27 +0,0 @@ -locals { - core = { - cache.t2.micro = 1 - cache.t2.small = 1 - cache.t2.medium = 2 - cache.m3.medium = 1 - cache.m3.large = 2 - cache.m3.xlarge = 4 - cache.m3.2xlarge = 8 - cache.m4.large = 2 - cache.m4.xlarge = 4 - cache.m4.2xlarge = 8 - cache.m4.4xlarge = 16 - cache.m4.10xlarge = 40 - cache.r3.large = 2 - cache.r3.xlarge = 4 - cache.r3.2xlarge = 8 - cache.r3.4xlarge = 16 - cache.r3.8xlarge = 32 - cache.r4.large = 2 - cache.r4.xlarge = 4 - cache.r4.2xlarge = 8 - cache.r4.4xlarge = 16 - cache.r4.8xlarge = 32 - cache.r4.16xlarge = 64 - } -} diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 0232498..b5c7935 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -53,17 +53,15 @@ resource "datadog_monitor" "redis_cpu_high" { name = "[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.cpu_high_message, var.message)}" - count = "${length(keys(local.core))}" - type = "metric alert" query = < ${var.cpu_high_threshold_critical / element(values(local.core), count.index)} + avg:aws.elasticache.engine_cpuutilization{${data.template_file.filter.rendered}} by {region,cacheclusterid,cachenodeid} + ) > ${var.cpu_high_threshold_critical} EOF - notify_no_data = false + notify_no_data = true evaluation_delay = "${var.delay}" renotify_interval = 0 notify_audit = false