From c36f2069507958c5332f94ff1719efea26123d40 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Wed, 16 May 2018 18:09:17 +0200 Subject: [PATCH] MON-32 - Monitors Updated --- cloud/aws/elasticache/memcached/README.md | 9 +++- cloud/aws/elasticache/memcached/inputs.tf | 33 +++++++++++++ .../memcached/monitors-memcached.tf | 34 +++++++++++++ cloud/aws/elasticache/redis/README.md | 36 +++++++------- cloud/aws/elasticache/redis/inputs.tf | 48 +++++++++---------- cloud/aws/elasticache/redis/monitors-redis.tf | 22 ++++----- 6 files changed, 128 insertions(+), 54 deletions(-) diff --git a/cloud/aws/elasticache/memcached/README.md b/cloud/aws/elasticache/memcached/README.md index 3e280d3..151ec88 100644 --- a/cloud/aws/elasticache/memcached/README.md +++ b/cloud/aws/elasticache/memcached/README.md @@ -18,6 +18,7 @@ Purpose ------- Creates DataDog monitors with the following checks : +* Get Hit * CPU High * Swap @@ -36,6 +37,12 @@ Inputs | environment | Architecture Environment | string | - | yes | | 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 | +| get_hits_aggregator | Monitor aggregator for Elasticache memcached get hits [available values: min, max, sum or avg] | string | `min` | no | +| get_hits_message | Custom message for Elasticache memcached get hits monitor | string | `` | no | +| get_hits_silenced | Groups to mute for Elasticache memcached get hits monitor | map | `` | no | +| get_hits_threshold_critical | Elasticache memcached get hits critical threshold in percentage | string | `10` | no | +| get_hits_threshold_warning | Elasticache memcached get hits warning threshold in percentage | string | `20` | no | +| get_hits_timeframe | Monitor timeframe for Elasticache memcached get hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | | message | Message sent when an alert is triggered | string | - | yes | | swap_aggregator | Monitor aggregator for Elasticache memcached swap [available values: min, max, sum or avg] | string | `min` | no | | swap_message | Custom message for Elasticache memcached swap monitor | string | `` | no | @@ -47,7 +54,7 @@ Inputs Related documentation --------------------- -DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_elasticache/](https://docs.datadoghq.com/integrations/amazon_elasticache/) +DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_elasticache/](https://docs.datadoghq.com/integrations/amazon_elasticache/) And more here: * [https://www.datadoghq.com/blog/monitoring-elasticache-performance-metrics-with-redis-or-memcached/](https://www.datadoghq.com/blog/monitoring-elasticache-performance-metrics-with-redis-or-memcached/) diff --git a/cloud/aws/elasticache/memcached/inputs.tf b/cloud/aws/elasticache/memcached/inputs.tf index 8510bd1..e87d13b 100644 --- a/cloud/aws/elasticache/memcached/inputs.tf +++ b/cloud/aws/elasticache/memcached/inputs.tf @@ -25,6 +25,39 @@ variable "filter_tags_custom" { } # Memcached specific +variable "get_hits_silenced" { + description = "Groups to mute for Elasticache memcached get hits monitor" + type = "map" + default = {} +} + +variable "get_hits_message" { + description = "Custom message for Elasticache memcached get hits monitor" + type = "string" + default = "" +} + +variable "get_hits_aggregator" { + description = "Monitor aggregator for Elasticache memcached get hits [available values: min, max, sum or avg]" + type = "string" + default = "min" +} + +variable "get_hits_timeframe" { + description = "Monitor timeframe for Elasticache memcached get hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + default = "last_15m" +} + +variable "get_hits_threshold_warning" { + description = "Elasticache memcached get hits warning threshold in percentage" + default = 20 +} + +variable "get_hits_threshold_critical" { + description = "Elasticache memcached get hits critical threshold in percentage" + default = 10 +} + variable "cpu_high_silenced" { description = "Groups to mute for Elasticache memcached cpu high monitor" type = "map" diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 62264ad..5fa6353 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -15,6 +15,40 @@ module "datadog-monitors-aws-elasticcache-common" { resource = "memcached" } +resource "datadog_monitor" "memcached_get_hits" { + name = "[${var.environment}] Elasticache memcached get hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = "${coalesce(var.get_hits_message, var.message)}" + + type = "metric alert" + + query = <` | no | -| cache_hit_threshold_critical | Elasticache Redis cache miss critical threshold in percentage | string | `10` | no | -| cache_hit_threshold_warning | Elasticache Redis cache miss warning threshold in percentage | string | `20` | no | -| cache_hit_timeframe | Monitor timeframe for Elasticache Redis cache miss [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | -| cpu_high_aggregator | Monitor aggregator for Elasticache Redis cpu high [available values: min, max, sum or avg] | string | `min` | no | -| cpu_high_message | Custom message for Elasticache Redis cpu high monitor | string | `` | no | -| cpu_high_silenced | Groups to mute for Elasticache Redis cpu high monitor | map | `` | no | -| cpu_high_threshold_critical | Elasticache Redis cpu high critical threshold in percentage | string | `90` | no | -| cpu_high_threshold_warning | Elasticache Redis cpu high warning threshold in percentage | string | `75` | no | -| cpu_high_timeframe | Monitor timeframe for Elasticache Redis cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | +| cache_hits_aggregator | Monitor aggregator for Elasticache redis cache hits [available values: min, max, sum or avg] | string | `min` | no | +| cache_hits_message | Custom message for Elasticache redis cache hits monitor | string | `` | no | +| cache_hits_silenced | Groups to mute for Elasticache redis cache hits monitor | map | `` | no | +| cache_hits_threshold_critical | Elasticache redis cache hits critical threshold in percentage | string | `10` | no | +| cache_hits_threshold_warning | Elasticache redis cache hits warning threshold in percentage | string | `20` | no | +| cache_hits_timeframe | Monitor timeframe for Elasticache redis cache hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | +| cpu_high_aggregator | Monitor aggregator for Elasticache redis cpu high [available values: min, max, sum or avg] | string | `min` | no | +| cpu_high_message | Custom message for Elasticache redis cpu high monitor | string | `` | no | +| cpu_high_silenced | Groups to mute for Elasticache redis cpu high monitor | map | `` | no | +| cpu_high_threshold_critical | Elasticache redis cpu high critical threshold in percentage | string | `90` | no | +| cpu_high_threshold_warning | Elasticache redis cpu high warning threshold in percentage | string | `75` | no | +| cpu_high_timeframe | Monitor timeframe for Elasticache redis cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | | delay | Delay in seconds for the metric evaluation | string | `900` | no | | environment | Architecture Environment | string | - | yes | | 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 an alert is triggered | string | - | yes | -| redis_size | Size of the Elasticache Redis instance | string | - | yes | -| swap_aggregator | Monitor aggregator for Elasticache Redis swap [available values: min, max, sum or avg] | string | `min` | no | -| swap_message | Custom message for Elasticache Redis swap monitor | string | `` | no | -| swap_silenced | Groups to mute for Elasticache Redis swap monitor | map | `` | no | -| swap_timeframe | Monitor timeframe for Elasticache Redis swap [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | +| redis_size | Size of the Elasticache redis instance | string | - | yes | +| swap_aggregator | Monitor aggregator for Elasticache redis swap [available values: min, max, sum or avg] | string | `min` | no | +| swap_message | Custom message for Elasticache redis swap monitor | string | `` | no | +| swap_silenced | Groups to mute for Elasticache redis swap monitor | map | `` | no | +| swap_timeframe | Monitor timeframe for Elasticache redis swap [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no | Related documentation --------------------- -DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_elasticache/](https://docs.datadoghq.com/integrations/amazon_elasticache/) +DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_elasticache/](https://docs.datadoghq.com/integrations/amazon_elasticache/) And more here: * [https://www.datadoghq.com/dashboards/elasticache-dashboard-redis/](https://www.datadoghq.com/dashboards/elasticache-dashboard-redis/) diff --git a/cloud/aws/elasticache/redis/inputs.tf b/cloud/aws/elasticache/redis/inputs.tf index 5c963f2..39a03da 100644 --- a/cloud/aws/elasticache/redis/inputs.tf +++ b/cloud/aws/elasticache/redis/inputs.tf @@ -24,97 +24,97 @@ variable "filter_tags_custom" { default = "*" } -# Redis specific +# redis specific variable "redis_size" { - description = "Size of the Elasticache Redis instance" + description = "Size of the Elasticache redis instance" type = "string" } -variable "cache_hit_silenced" { - description = "Groups to mute for Elasticache Redis cache miss monitor" +variable "cache_hits_silenced" { + description = "Groups to mute for Elasticache redis cache hits monitor" type = "map" default = {} } -variable "cache_hit_message" { - description = "Custom message for Elasticache Redis cache miss monitor" +variable "cache_hits_message" { + description = "Custom message for Elasticache redis cache hits monitor" type = "string" default = "" } -variable "cache_hit_aggregator" { - description = "Monitor aggregator for Elasticache Redis cache miss [available values: min, max, sum or avg]" +variable "cache_hits_aggregator" { + description = "Monitor aggregator for Elasticache redis cache hits [available values: min, max, sum or avg]" type = "string" default = "min" } -variable "cache_hit_timeframe" { - description = "Monitor timeframe for Elasticache Redis cache miss [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" +variable "cache_hits_timeframe" { + description = "Monitor timeframe for Elasticache redis cache hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" default = "last_15m" } -variable "cache_hit_threshold_warning" { - description = "Elasticache Redis cache miss warning threshold in percentage" +variable "cache_hits_threshold_warning" { + description = "Elasticache redis cache hits warning threshold in percentage" default = 20 } -variable "cache_hit_threshold_critical" { - description = "Elasticache Redis cache miss critical threshold in percentage" +variable "cache_hits_threshold_critical" { + description = "Elasticache redis cache hits critical threshold in percentage" default = 10 } variable "cpu_high_silenced" { - description = "Groups to mute for Elasticache Redis cpu high monitor" + description = "Groups to mute for Elasticache redis cpu high monitor" type = "map" default = {} } variable "cpu_high_message" { - description = "Custom message for Elasticache Redis cpu high monitor" + description = "Custom message for Elasticache redis cpu high monitor" type = "string" default = "" } variable "cpu_high_aggregator" { - description = "Monitor aggregator for Elasticache Redis cpu high [available values: min, max, sum or avg]" + description = "Monitor aggregator for Elasticache redis cpu high [available values: min, max, sum or avg]" type = "string" default = "min" } variable "cpu_high_timeframe" { - description = "Monitor timeframe for Elasticache Redis cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + description = "Monitor timeframe for Elasticache redis cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" default = "last_15m" } variable "cpu_high_threshold_warning" { - description = "Elasticache Redis cpu high warning threshold in percentage" + description = "Elasticache redis cpu high warning threshold in percentage" default = 75 } variable "cpu_high_threshold_critical" { - description = "Elasticache Redis cpu high critical threshold in percentage" + description = "Elasticache redis cpu high critical threshold in percentage" default = 90 } variable "swap_silenced" { - description = "Groups to mute for Elasticache Redis swap monitor" + description = "Groups to mute for Elasticache redis swap monitor" type = "map" default = {} } variable "swap_message" { - description = "Custom message for Elasticache Redis swap monitor" + description = "Custom message for Elasticache redis swap monitor" type = "string" default = "" } variable "swap_aggregator" { - description = "Monitor aggregator for Elasticache Redis swap [available values: min, max, sum or avg]" + description = "Monitor aggregator for Elasticache redis swap [available values: min, max, sum or avg]" type = "string" default = "min" } variable "swap_timeframe" { - description = "Monitor timeframe for Elasticache Redis swap [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + description = "Monitor timeframe for Elasticache redis swap [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" default = "last_15m" } diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 68a9436..9a7a47f 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -15,23 +15,23 @@ module "datadog-monitors-aws-elasticcache-common" { resource = "redis" } -resource "datadog_monitor" "redis_cache_hit" { - name = "[${var.environment}] Elasticache redis cache hit {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cache_hit_message, var.message)}" +resource "datadog_monitor" "redis_cache_hits" { + name = "[${var.environment}] Elasticache redis cache hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = "${coalesce(var.cache_hits_message, var.message)}" type = "metric alert" query = <