MON-32 add enabled feature

This commit is contained in:
Quentin Manfroi 2018-09-19 19:26:57 +02:00
parent 22d1cbc4ae
commit 2a51f920c4
6 changed files with 132 additions and 0 deletions

View File

@ -35,6 +35,11 @@ variable "eviction_silenced" {
type = "map" type = "map"
} }
variable "eviction_enabled" {
description = "Flag to enable Elasticache eviction monitor"
type = "string"
default = "true"
}
variable "eviction_extra_tags" { variable "eviction_extra_tags" {
description = "Extra tags for Elasticache eviction monitor" description = "Extra tags for Elasticache eviction monitor"
type = "list" type = "list"
@ -60,6 +65,11 @@ variable "max_connection_silenced" {
type = "map" type = "map"
} }
variable "max_connection_enabled" {
description = "Flag to enable Elasticache max connection monitor"
type = "string"
default = "true"
}
variable "max_connection_extra_tags" { variable "max_connection_extra_tags" {
description = "Extra tags for Elasticache max connection monitor" description = "Extra tags for Elasticache max connection monitor"
type = "list" type = "list"
@ -85,6 +95,11 @@ variable "no_connection_silenced" {
type = "map" type = "map"
} }
variable "no_connection_enabled" {
description = "Flag to enable Elasticache no connection monitor"
type = "string"
default = "true"
}
variable "no_connection_extra_tags" { variable "no_connection_extra_tags" {
description = "Extra tags for Elasticache no connection monitor" description = "Extra tags for Elasticache no connection monitor"
type = "list" type = "list"
@ -110,6 +125,11 @@ variable "swap_silenced" {
type = "map" type = "map"
} }
variable "swap_enabled" {
description = "Flag to enable Elasticache swap monitor"
type = "string"
default = "true"
}
variable "swap_extra_tags" { variable "swap_extra_tags" {
description = "Extra tags for Elasticache swap monitor" description = "Extra tags for Elasticache swap monitor"
type = "list" type = "list"
@ -143,6 +163,11 @@ variable "free_memory_silenced" {
type = "map" type = "map"
} }
variable "free_memory_enabled" {
description = "Flag to enable Elasticache free memory monitor"
type = "string"
default = "true"
}
variable "free_memory_extra_tags" { variable "free_memory_extra_tags" {
description = "Extra tags for Elasticache free memory monitor" description = "Extra tags for Elasticache free memory monitor"
type = "list" type = "list"
@ -175,6 +200,11 @@ variable "eviction_growing_silenced" {
type = "map" type = "map"
} }
variable "eviction_growing_enabled" {
description = "Flag to enable Elasticache eviction growing monitor"
type = "string"
default = "true"
}
variable "eviction_growing_extra_tags" { variable "eviction_growing_extra_tags" {
description = "Extra tags for Elasticache eviction growing monitor" description = "Extra tags for Elasticache eviction growing monitor"
type = "list" type = "list"

View File

@ -1,4 +1,5 @@
resource "datadog_monitor" "elasticache_eviction" { resource "datadog_monitor" "elasticache_eviction" {
count = "${var.eviction_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache eviction {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}" name = "[${var.environment}] Elasticache eviction {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}"
message = "${coalesce(var.eviction_message, var.message)}" message = "${coalesce(var.eviction_message, var.message)}"
@ -26,6 +27,7 @@ resource "datadog_monitor" "elasticache_eviction" {
} }
resource "datadog_monitor" "elasticache_max_connection" { resource "datadog_monitor" "elasticache_max_connection" {
count = "${var.max_connection_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" name = "[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}"
message = "${coalesce(var.max_connection_message, var.message)}" message = "${coalesce(var.max_connection_message, var.message)}"
@ -53,6 +55,7 @@ resource "datadog_monitor" "elasticache_max_connection" {
} }
resource "datadog_monitor" "elasticache_no_connection" { resource "datadog_monitor" "elasticache_no_connection" {
count = "${var.no_connection_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" name = "[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}"
message = "${coalesce(var.no_connection_message, var.message)}" message = "${coalesce(var.no_connection_message, var.message)}"
@ -80,6 +83,7 @@ resource "datadog_monitor" "elasticache_no_connection" {
} }
resource "datadog_monitor" "elasticache_swap" { resource "datadog_monitor" "elasticache_swap" {
count = "${var.swap_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache swap {{#is_alert}}{{{comparator}}} {{threshold}}MB ({{value}}MB){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}MB ({{value}}MB){{/is_warning}}" name = "[${var.environment}] Elasticache swap {{#is_alert}}{{{comparator}}} {{threshold}}MB ({{value}}MB){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}MB ({{value}}MB){{/is_warning}}"
message = "${coalesce(var.swap_message, var.message)}" message = "${coalesce(var.swap_message, var.message)}"
@ -113,6 +117,7 @@ resource "datadog_monitor" "elasticache_swap" {
# POC - A approfondir # POC - A approfondir
resource "datadog_monitor" "elasticache_free_memory" { resource "datadog_monitor" "elasticache_free_memory" {
count = "${var.free_memory_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache free memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Elasticache free memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.free_memory_message, var.message)}" message = "${coalesce(var.free_memory_message, var.message)}"
@ -145,6 +150,7 @@ resource "datadog_monitor" "elasticache_free_memory" {
} }
resource "datadog_monitor" "elasticache_eviction_growing" { resource "datadog_monitor" "elasticache_eviction_growing" {
count = "${var.eviction_growing_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache evictions is growing {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" name = "[${var.environment}] Elasticache evictions is growing {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}"
message = "${coalesce(var.eviction_growing_message, var.message)}" message = "${coalesce(var.eviction_growing_message, var.message)}"

View File

@ -35,6 +35,11 @@ variable "get_hits_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "get_hits_enabled" {
description = "Flag to enable Elasticache memcached get hits monitor"
type = "string"
default = "true"
}
variable "get_hits_extra_tags" { variable "get_hits_extra_tags" {
description = "Extra tags for Elasticache memcached get hits monitor" description = "Extra tags for Elasticache memcached get hits monitor"
@ -68,6 +73,11 @@ variable "cpu_high_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "cpu_high_enabled" {
description = "Flag to enable Elasticache memcached cpu high monitor"
type = "string"
default = "true"
}
variable "cpu_high_extra_tags" { variable "cpu_high_extra_tags" {
description = "Extra tags for Elasticache memcached cpu high monitor" description = "Extra tags for Elasticache memcached cpu high monitor"
@ -108,6 +118,11 @@ variable "eviction_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "eviction_enabled" {
description = "Flag to enable Elasticache eviction monitor"
type = "string"
default = "true"
}
variable "eviction_message" { variable "eviction_message" {
description = "Custom message for Elasticache eviction monitor" description = "Custom message for Elasticache eviction monitor"
@ -131,6 +146,11 @@ variable "max_connection_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "max_connection_enabled" {
description = "Flag to enable Elasticache max connection monitor"
type = "string"
default = "true"
}
variable "max_connection_message" { variable "max_connection_message" {
description = "Custom message for Elasticache max connection monitor" description = "Custom message for Elasticache max connection monitor"
@ -154,6 +174,11 @@ variable "no_connection_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "no_connection_enabled" {
description = "Flag to enable Elasticache no connection monitor"
type = "string"
default = "true"
}
variable "no_connection_message" { variable "no_connection_message" {
description = "Custom message for Elasticache no connection monitor" description = "Custom message for Elasticache no connection monitor"
@ -177,6 +202,11 @@ variable "swap_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "swap_enabled" {
description = "Flag to enable Elasticache swap monitor"
type = "string"
default = "true"
}
variable "swap_message" { variable "swap_message" {
description = "Custom message for Elasticache swap monitor" description = "Custom message for Elasticache swap monitor"
@ -210,6 +240,11 @@ variable "free_memory_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "free_memory_enabled" {
description = "Flag to enable Elasticache free memory monitor"
type = "string"
default = "true"
}
variable "free_memory_message" { variable "free_memory_message" {
description = "Custom message for Elasticache free memory monitor" description = "Custom message for Elasticache free memory monitor"
@ -242,6 +277,11 @@ variable "eviction_growing_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "eviction_growing_enabled" {
description = "Flag to enable Elasticache eviction growing monitor"
type = "string"
default = "true"
}
variable "eviction_growing_message" { variable "eviction_growing_message" {
description = "Custom message for Elasticache eviction growing monitor" description = "Custom message for Elasticache eviction growing monitor"

View File

@ -54,6 +54,7 @@ module "datadog-monitors-aws-elasticache-common" {
} }
resource "datadog_monitor" "memcached_get_hits" { resource "datadog_monitor" "memcached_get_hits" {
count = "${var.get_hits_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache memcached get hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" 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)}" message = "${coalesce(var.get_hits_message, var.message)}"
@ -88,6 +89,7 @@ resource "datadog_monitor" "memcached_get_hits" {
} }
resource "datadog_monitor" "memcached_cpu_high" { resource "datadog_monitor" "memcached_cpu_high" {
count = "${var.cpu_high_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.cpu_high_message, var.message)}" message = "${coalesce(var.cpu_high_message, var.message)}"

View File

@ -35,6 +35,11 @@ variable "cache_hits_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "cache_hits_enabled" {
description = "Flag to enable Elasticache redis cache hits monitor"
type = "string"
default = "true"
}
variable "cache_hits_extra_tags" { variable "cache_hits_extra_tags" {
description = "Extra tags for Elasticache redis cache hits monitor" description = "Extra tags for Elasticache redis cache hits monitor"
@ -68,6 +73,11 @@ variable "cpu_high_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "cpu_high_enabled" {
description = "Flag to enable Elasticache redis cpu high monitor"
type = "string"
default = "true"
}
variable "cpu_high_extra_tags" { variable "cpu_high_extra_tags" {
description = "Extra tags for Elasticache redis cpu high monitor" description = "Extra tags for Elasticache redis cpu high monitor"
@ -107,6 +117,11 @@ variable "replication_lag_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "replication_lag_enabled" {
description = "Flag to enable Elasticache redis replication lag monitor"
type = "string"
default = "true"
}
variable "replication_lag_extra_tags" { variable "replication_lag_extra_tags" {
description = "Extra tags for Elasticache redis replication lag monitor" description = "Extra tags for Elasticache redis replication lag monitor"
@ -146,6 +161,11 @@ variable "commands_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "commands_enabled" {
description = "Flag to enable Elasticache redis commands monitor"
type = "string"
default = "true"
}
variable "commands_extra_tags" { variable "commands_extra_tags" {
description = "Extra tags for Elasticache redis commands monitor" description = "Extra tags for Elasticache redis commands monitor"
@ -170,6 +190,11 @@ variable "eviction_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "eviction_enabled" {
description = "Flag to enable Elasticache eviction monitor"
type = "string"
default = "true"
}
variable "eviction_message" { variable "eviction_message" {
description = "Custom message for Elasticache eviction monitor" description = "Custom message for Elasticache eviction monitor"
@ -193,6 +218,11 @@ variable "max_connection_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "max_connection_enabled" {
description = "Flag to enable Elasticache max connection monitor"
type = "string"
default = "true"
}
variable "max_connection_message" { variable "max_connection_message" {
description = "Custom message for Elasticache max connection monitor" description = "Custom message for Elasticache max connection monitor"
@ -216,6 +246,11 @@ variable "no_connection_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "no_connection_enabled" {
description = "Flag to enable Elasticache no connection monitor"
type = "string"
default = "true"
}
variable "no_connection_message" { variable "no_connection_message" {
description = "Custom message for Elasticache no connection monitor" description = "Custom message for Elasticache no connection monitor"
@ -239,6 +274,11 @@ variable "swap_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "swap_enabled" {
description = "Flag to enable Elasticache swap monitor"
type = "string"
default = "true"
}
variable "swap_message" { variable "swap_message" {
description = "Custom message for Elasticache swap monitor" description = "Custom message for Elasticache swap monitor"
@ -272,6 +312,11 @@ variable "free_memory_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "free_memory_enabled" {
description = "Flag to enable Elasticache free memory monitor"
type = "string"
default = "true"
}
variable "free_memory_message" { variable "free_memory_message" {
description = "Custom message for Elasticache free memory monitor" description = "Custom message for Elasticache free memory monitor"
@ -304,6 +349,11 @@ variable "eviction_growing_silenced" {
type = "map" type = "map"
default = {} default = {}
} }
variable "eviction_growing_enabled" {
description = "Flag to enable Elasticache eviction growing monitor"
type = "string"
default = "true"
}
variable "eviction_growing_message" { variable "eviction_growing_message" {
description = "Custom message for Elasticache eviction growing monitor" description = "Custom message for Elasticache eviction growing monitor"

View File

@ -54,6 +54,7 @@ module "datadog-monitors-aws-elasticache-common" {
} }
resource "datadog_monitor" "redis_cache_hits" { resource "datadog_monitor" "redis_cache_hits" {
count = "${var.cache_hits_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache redis cache hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" 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)}" message = "${coalesce(var.cache_hits_message, var.message)}"
@ -88,6 +89,7 @@ resource "datadog_monitor" "redis_cache_hits" {
} }
resource "datadog_monitor" "redis_cpu_high" { resource "datadog_monitor" "redis_cpu_high" {
count = "${var.cpu_high_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.cpu_high_message, var.message)}" message = "${coalesce(var.cpu_high_message, var.message)}"
@ -115,6 +117,7 @@ resource "datadog_monitor" "redis_cpu_high" {
} }
resource "datadog_monitor" "redis_replication_lag" { resource "datadog_monitor" "redis_replication_lag" {
count = "${var.replication_lag_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache redis replication lag {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" name = "[${var.environment}] Elasticache redis replication lag {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}"
message = "${coalesce(var.replication_lag_message, var.message)}" message = "${coalesce(var.replication_lag_message, var.message)}"
@ -147,6 +150,7 @@ resource "datadog_monitor" "redis_replication_lag" {
} }
resource "datadog_monitor" "redis_commands" { resource "datadog_monitor" "redis_commands" {
count = "${var.commands_enabled ? 1 : 0}"
name = "[${var.environment}] Elasticache redis is receiving no commands" name = "[${var.environment}] Elasticache redis is receiving no commands"
message = "${coalesce(var.commands_message, var.message)}" message = "${coalesce(var.commands_message, var.message)}"