# # Service Check # resource "datadog_monitor" "not_responding" { count = "${var.not_responding_enabled ? 1 : 0}" name = "[${var.environment}] Redis does not respond" message = "${coalesce(var.not_responding_message, var.message)}" type = "service check" query = < ${var.evictedkeys_change_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.evictedkeys_change_threshold_warning}" critical = "${var.evictedkeys_change_threshold_critical}" } silenced = "${var.evictedkeys_change_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = true new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.evictedkeys_change_extra_tags}"] } resource "datadog_monitor" "expirations" { count = "${var.expirations_rate_enabled ? 1 : 0}" name = "[${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)}" query = < ${var.expirations_rate_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.expirations_rate_threshold_warning}" critical = "${var.expirations_rate_threshold_critical}" } silenced = "${var.expirations_rate_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.expirations_rate_extra_tags}"] } resource "datadog_monitor" "blocked_clients" { count = "${var.blocked_clients_enabled ? 1 : 0}" name = "[${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)}" query = < ${var.blocked_clients_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.blocked_clients_threshold_warning}" critical = "${var.blocked_clients_threshold_critical}" } silenced = "${var.blocked_clients_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.blocked_clients_extra_tags}"] } resource "datadog_monitor" "keyspace_full" { count = "${var.keyspace_enabled ? 1 : 0}" 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 type = "metric alert" thresholds { warning = "${var.mem_used_threshold_warning}" critical = "${var.mem_used_threshold_critical}" } silenced = "${var.mem_used_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.mem_used_extra_tags}"] } resource "datadog_monitor" "memory_frag" { count = "${var.mem_frag_enabled ? 1 : 0}" name = "[${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)}" query = < ${var.mem_frag_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.mem_frag_threshold_warning}" critical = "${var.mem_frag_threshold_critical}" } silenced = "${var.mem_frag_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.mem_frag_extra_tags}"] } resource "datadog_monitor" "rejected_connections" { count = "${var.rejected_con_enabled ? 1 : 0}" name = "[${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)}" query = < ${var.rejected_con_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.rejected_con_threshold_warning}" critical = "${var.rejected_con_threshold_critical}" } silenced = "${var.rejected_con_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.rejected_con_extra_tags}"] } resource "datadog_monitor" "latency" { count = "${var.latency_enabled ? 1 : 0}" name = "[${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)}" query = < ${var.latency_threshold_critical} EOL type = "metric alert" thresholds { warning = "${var.latency_threshold_warning}" critical = "${var.latency_threshold_critical}" } silenced = "${var.latency_silenced}" notify_no_data = false evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false new_host_delay = "${var.new_host_delay}" tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] } resource "datadog_monitor" "hitrate" { count = "${var.hitrate_enabled ? 1 : 0}" name = "[${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)}" query = <