Merged in MON-76_azure_redis (pull request #10)
MON-76: Azure Redis - DataDog Monitors Approved-by: Jérôme Respaut <shr3ps@gmail.com> Approved-by: Laurent Piroelle <laurent.piroelle@fr.clara.net> Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net> Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr> Approved-by: Adrien Broyere <adrien.broyere@fr.clara.net>
This commit is contained in:
commit
066ead6d95
47
cloud/azure/redis/README.md
Normal file
47
cloud/azure/redis/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
Azure Redis DataDog monitors
|
||||
============================
|
||||
|
||||
How to use this module
|
||||
----------------------
|
||||
|
||||
```
|
||||
module "datadog-monitors-azure-redis" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/redis?ref={revision}"
|
||||
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
environment = "${var.environment}"
|
||||
}
|
||||
```
|
||||
|
||||
Purpose
|
||||
-------
|
||||
Creates a DataDog monitors with the following checks :
|
||||
|
||||
* Service status check
|
||||
* Evicted keys count check
|
||||
* Processor time (percent) threshold
|
||||
* Server CPU load threshold
|
||||
|
||||
Inputs
|
||||
------
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
||||
| environment | Architecture environment | string | - | yes |
|
||||
| evictedkeys_limit_threshold_critical | Evicted keys limit (critical threshold) | string | `100` | no |
|
||||
| evictedkeys_limit_threshold_warning | Evicted keys limit (warning threshold) | string | `0` | no |
|
||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||
| message | Message sent when a Redis monitor is triggered | string | - | yes |
|
||||
| percent_processor_time_threshold_critical | Processor time percent (critical threshold) | string | `80` | no |
|
||||
| percent_processor_time_threshold_warning | Processor time percent (warning threshold) | string | `60` | no |
|
||||
| server_load_rate_threshold_critical | Server CPU load rate (critical threshold) | string | `90` | no |
|
||||
| server_load_rate_threshold_warning | Server CPU load rate (warning threshold) | string | `70` | no |
|
||||
|
||||
Related documentation
|
||||
---------------------
|
||||
|
||||
DataDog documentation: [https://docs.datadoghq.com/integrations/azure_redis_cache/](https://docs.datadoghq.com/integrations/azure_redis_cache/)
|
||||
|
||||
Azure Redis metrics documentation: [https://docs.microsoft.com/en-us/azure/redis-cache/cache-how-to-monitor](https://docs.microsoft.com/en-us/azure/redis-cache/cache-how-to-monitor)
|
||||
56
cloud/azure/redis/inputs.tf
Normal file
56
cloud/azure/redis/inputs.tf
Normal file
@ -0,0 +1,56 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "message" {
|
||||
description = "Message sent when a Redis monitor is triggered"
|
||||
}
|
||||
|
||||
variable "delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 600
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
# Azure Redis specific
|
||||
variable "evictedkeys_limit_threshold_warning" {
|
||||
description = "Evicted keys limit (warning threshold)"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "evictedkeys_limit_threshold_critical" {
|
||||
description = "Evicted keys limit (critical threshold)"
|
||||
default = 100
|
||||
}
|
||||
|
||||
variable "percent_processor_time_threshold_critical" {
|
||||
description = "Processor time percent (critical threshold)"
|
||||
default = 80
|
||||
}
|
||||
|
||||
variable "percent_processor_time_threshold_warning" {
|
||||
description = "Processor time percent (warning threshold)"
|
||||
default = 60
|
||||
}
|
||||
|
||||
variable "server_load_rate_threshold_critical" {
|
||||
description = "Server CPU load rate (critical threshold)"
|
||||
default = 90
|
||||
}
|
||||
|
||||
variable "server_load_rate_threshold_warning" {
|
||||
description = "Server CPU load rate (warning threshold)"
|
||||
default = 70
|
||||
}
|
||||
124
cloud/azure/redis/monitors-azure-redis.tf
Normal file
124
cloud/azure/redis/monitors-azure-redis.tf
Normal file
@ -0,0 +1,124 @@
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_azure_redis:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "status" {
|
||||
name = "[${var.environment}] Redis {{name}} is down"
|
||||
message = "${var.message}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m):avg:azure.cache_redis.status{${data.template_file.filter.rendered}} by {name,resource_group} != 1
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.delay}"
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = true
|
||||
new_host_delay = "${var.delay}"
|
||||
no_data_timeframe = 20
|
||||
|
||||
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "evictedkeys" {
|
||||
name = "[${var.environment}] Redis {{value}} evictedkeys on {{name}}"
|
||||
message = "${var.message}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m): (
|
||||
avg:azure.cache_redis.evictedkeys{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||
) > ${var.evictedkeys_limit_threshold_critical}
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
thresholds {
|
||||
warning = "${var.evictedkeys_limit_threshold_warning}"
|
||||
critical = "${var.evictedkeys_limit_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = true
|
||||
new_host_delay = "${var.delay}"
|
||||
no_data_timeframe = 20
|
||||
|
||||
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "percent_processor_time" {
|
||||
name = "[${var.environment}] Redis processor time {{value}}% on {{name}}"
|
||||
message = "${var.message}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m): (
|
||||
avg:azure.cache_redis.percent_processor_time{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||
) > ${var.percent_processor_time_threshold_critical}
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
thresholds {
|
||||
warning = "${var.percent_processor_time_threshold_warning}"
|
||||
critical = "${var.percent_processor_time_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = true
|
||||
new_host_delay = "${var.delay}"
|
||||
no_data_timeframe = 20
|
||||
|
||||
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "server_load" {
|
||||
name = "[${var.environment}] Redis processor server load {{value}}% on {{name}}"
|
||||
message = "${var.message}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m): (
|
||||
avg:azure.cache_redis.server_load{${data.template_file.filter.rendered}} by {name,resource_group}
|
||||
) > ${var.server_load_rate_threshold_critical}
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
thresholds {
|
||||
warning = "${var.server_load_rate_threshold_warning}"
|
||||
critical = "${var.server_load_rate_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = true
|
||||
new_host_delay = "${var.delay}"
|
||||
no_data_timeframe = 20
|
||||
|
||||
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user