diff --git a/middleware/redis/README.md b/middleware/redis/README.md index d3300db..d560174 100644 --- a/middleware/redis/README.md +++ b/middleware/redis/README.md @@ -16,10 +16,10 @@ module "datadog-monitors-middleware-redis" { Creates DataDog monitors with the following checks: -- Redis suddenly too many evicted keys +- Redis too many evicted keys - Redis too many expired keys - Redis too many blocked clients -- Redis keyspace seems full +- Redis keyspace seems full (no changes since ${var.keyspace_timeframe}) - Redis too many ram memory used - Redis memory ram fragmented - Redis too many rejected connections diff --git a/middleware/redis/monitors-redis.tf b/middleware/redis/monitors-redis.tf index 383caa0..db4a5f2 100644 --- a/middleware/redis/monitors-redis.tf +++ b/middleware/redis/monitors-redis.tf @@ -2,17 +2,17 @@ data "template_file" "filter" { template = "$${filter}" vars { - filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_redis:enabled,db_env:%s", var.environment) : "${var.filter_tags_custom}"}" + filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_redis:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}" } } resource "datadog_monitor" "redis_evictedkeys" { - name = "[${var.environment}] Redis suddenly too many evicted keys {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis too many evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" message = "${coalesce(var.evictedkeys_change_message, var.message)}" query = < ${var.evictedkeys_change_threshold_critical} EOL @@ -36,19 +36,19 @@ EOL timeout_h = 0 include_tags = true locked = false - require_full_window = false + require_full_window = true new_host_delay = "${var.delay}" tags = ["env:${var.environment}", "resource:redis"] } resource "datadog_monitor" "redis_expirations" { - name = "[${var.environment}] Redis too many expired keys {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis too many expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.expirations_rate_message, var.message)}" query = < ${var.expirations_rate_threshold_critical} EOL @@ -79,13 +79,13 @@ EOL } resource "datadog_monitor" "redis_blocked_clients" { - name = "[${var.environment}] Redis too many blocked clients {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis too many blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.blocked_clients_message, var.message)}" query = < ${var.blocked_clients_threshold_critical} EOL @@ -116,12 +116,12 @@ EOL } resource "datadog_monitor" "redis_keyspace" { - name = "[${var.environment}] Redis keyspace seems full {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis keyspace seems full (no changes since ${var.keyspace_timeframe})" message = "${coalesce(var.keyspace_message, var.message)}" query = < ${var.mem_used_threshold_critical} EOL @@ -189,12 +189,12 @@ EOL } resource "datadog_monitor" "redis_mem_frag" { - name = "[${var.environment}] Redis memory ram fragmented {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis memory ram fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.mem_frag_message, var.message)}" query = < ${var.mem_frag_threshold_critical} EOL @@ -230,7 +230,7 @@ resource "datadog_monitor" "redis_rejected_con" { query = < ${var.rejected_con_threshold_critical} EOL @@ -261,12 +261,12 @@ EOL } resource "datadog_monitor" "redis_latency" { - name = "[${var.environment}] Redis latency is too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis latency is too high {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}){{/is_warning}}" message = "${coalesce(var.latency_message, var.message)}" query = < ${var.latency_threshold_critical} EOL @@ -297,14 +297,14 @@ EOL } resource "datadog_monitor" "redis_hitrate" { - name = "[${var.environment}] Redis hitrate is too low {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + name = "[${var.environment}] Redis hitrate is too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.hitrate_message, var.message)}" query = <