MON-32 - CPU Redis monitors updated with new metric

This commit is contained in:
Alexandre Gaillet 2018-06-08 11:25:05 +02:00 committed by Quentin Manfroi
parent d126e898d3
commit 4a1c0261be
3 changed files with 4 additions and 32 deletions

View File

@ -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)}"

View File

@ -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
}
}

View File

@ -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 = <<EOF
${var.cpu_high_time_aggregator}(${var.cpu_high_timeframe}): (
avg:aws.elasticache.cpuutilization{dd_monitoring:enabled,dd_aws_elasticache_redis:enabled,env:${var.environment},cache_node_type:${element(keys(local.core), count.index)}} by {region,cacheclusterid,cachenodeid}
) > ${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