# # Service Check # resource "datadog_monitor" "not_responding" { count = var.not_responding_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis does not respond" message = coalesce(var.not_responding_message, var.message) type = "service check" query = < ${var.evictedkeys_change_threshold_critical} EOQ thresholds = { warning = var.evictedkeys_change_threshold_warning critical = var.evictedkeys_change_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "expirations" { count = var.expirations_rate_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis 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) type = "query alert" query = < ${var.expirations_rate_threshold_critical} EOQ thresholds = { warning = var.expirations_rate_threshold_warning critical = var.expirations_rate_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "blocked_clients" { count = var.blocked_clients_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis 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) type = "query alert" query = < ${var.blocked_clients_threshold_critical} EOQ thresholds = { warning = var.blocked_clients_threshold_warning critical = var.blocked_clients_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.blocked_clients_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "keyspace_full" { count = var.keyspace_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis keyspace seems full (no changes since ${var.keyspace_timeframe})" message = coalesce(var.keyspace_message, var.message) type = "query alert" query = < ${var.mem_used_threshold_critical} EOQ thresholds = { warning = var.mem_used_threshold_warning critical = var.mem_used_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "memory_frag" { count = var.mem_frag_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.mem_frag_message, var.message) type = "query alert" query = < ${var.mem_frag_threshold_critical} EOQ thresholds = { warning = var.mem_frag_threshold_warning critical = var.mem_frag_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "rejected_connections" { count = var.rejected_con_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = coalesce(var.rejected_con_message, var.message) type = "query alert" query = < ${var.rejected_con_threshold_critical} EOQ thresholds = { warning = var.rejected_con_threshold_warning critical = var.rejected_con_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.rejected_con_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "latency" { count = var.latency_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}){{/is_warning}}" message = coalesce(var.latency_message, var.message) type = "query alert" query = < ${var.latency_threshold_critical} EOQ thresholds = { warning = var.latency_threshold_warning critical = var.latency_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.latency_extra_tags) lifecycle { ignore_changes = ["silenced"] } } resource "datadog_monitor" "hitrate" { count = var.hitrate_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis hitrate {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.hitrate_message, var.message) type = "query alert" query = <