From 6e6147088cbb58c322031c3f2169001025a0cae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Respaut?= Date: Mon, 30 Oct 2017 11:34:42 +0100 Subject: [PATCH] MON-76: Azure Redis - DataDog Monitors --- cloud/azure/redis/inputs.tf | 31 +++++++++++++++++ cloud/azure/redis/monitors-azure-redis.tf | 42 +++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 cloud/azure/redis/inputs.tf create mode 100644 cloud/azure/redis/monitors-azure-redis.tf 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 +}