diff --git a/cloud/azure/redis/inputs.tf b/cloud/azure/redis/inputs.tf new file mode 100644 index 0000000..70eba23 --- /dev/null +++ b/cloud/azure/redis/inputs.tf @@ -0,0 +1,31 @@ +# Global Terraform +variable "client_name" { + type = "string" +} + +variable "environment" { + type = "string" +} + +variable "stack" { + type = "string" +} + +# Global DataDog +variable "critical_escalation_group" { +} + +variable "warning_escalation_group" { +} + +variable "delay" { + default = 600 +} + +# Azure Redis specific +variable "evictedkeys_threshold_warning" { + default = 0 +} +variable "evictedkeys_threshold_critical" { + default = 100 +} diff --git a/cloud/azure/redis/monitors-azure-redis.tf b/cloud/azure/redis/monitors-azure-redis.tf new file mode 100644 index 0000000..ec562b9 --- /dev/null +++ b/cloud/azure/redis/monitors-azure-redis.tf @@ -0,0 +1,42 @@ +resource "datadog_monitor" "status" { + name = "[${var.environment}] Redis {{name}} is down" + message = "{{#is_alert}}\n${var.critical_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.critical_escalation_group}\n{{/is_recovery}}" + + query = "avg(last_5m):avg:azure.cache_redis.status{*} by {name,resource_group} != 1" + type = "query alert" + + notify_no_data = false + evaluation_delay = "${var.delay}" + renotify_interval = 60 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + new_host_delay = "${var.delay}" + no_data_timeframe = 20 +} + +resource "datadog_monitor" "evictedkeys" { + name = "[${var.environment}] Redis {{value}} evictedkeys on {{name}}" + message = "{{#is_alert}}\n${var.critical_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.critical_escalation_group}\n{{/is_recovery}}" + + query = "avg(last_5m):avg:azure.cache_redis.evictedkeys{*} by {name,resource_group} > ${var.evictedkeys_threshold_critical}" + type = "query alert" + + thresholds { + warning = "${var.evictedkeys_threshold_warning}" + critical = "${var.evictedkeys_threshold_critical}" + } + + notify_no_data = false + evaluation_delay = "${var.delay}" + renotify_interval = 60 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + new_host_delay = "${var.delay}" + no_data_timeframe = 20 +}