MON-271 Readable name for all monitors

This commit is contained in:
Rafael Romero Carmona 2018-07-31 17:27:28 +02:00 committed by Quentin Manfroi
parent a446559789
commit cfdfb64739
3 changed files with 45 additions and 46 deletions

View File

@ -95,15 +95,15 @@ Creates DataDog monitors with the following checks:
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| redis_blocked_clients_id | id for monitor redis_blocked_clients | | blocked_clients_id | id for monitor blocked_clients |
| redis_evictedkeys_id | id for monitor redis_evictedkeys | | evicted_keys_id | id for monitor evicted_keys |
| redis_expirations_id | id for monitor redis_expirations | | expirations_id | id for monitor expirations |
| redis_hitrate_id | id for monitor redis_hitrate | | hitrate_id | id for monitor hitrate |
| redis_keyspace_id | id for monitor redis_keyspace | | keyspace_full_id | id for monitor keyspace_full |
| redis_latency_id | id for monitor redis_latency | | latency_id | id for monitor latency |
| redis_mem_frag_id | id for monitor redis_mem_frag | | memory_frag_id | id for monitor memory_frag |
| redis_mem_used_id | id for monitor redis_mem_used | | memory_used_id | id for monitor memory_used |
| redis_rejected_con_id | id for monitor redis_rejected_con | | rejected_connections_id | id for monitor rejected_connections |
## Related documentation ## Related documentation

View File

@ -6,7 +6,7 @@ data "template_file" "filter" {
} }
} }
resource "datadog_monitor" "redis_evictedkeys" { resource "datadog_monitor" "evicted_keys" {
name = "[${var.environment}] Redis too many evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" name = "[${var.environment}] Redis too many evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}"
message = "${coalesce(var.evictedkeys_change_message, var.message)}" message = "${coalesce(var.evictedkeys_change_message, var.message)}"
@ -40,14 +40,13 @@ EOL
new_host_delay = "${var.delay}" new_host_delay = "${var.delay}"
tags = [ tags = [
"created_by:terraform",
"created_by:terraform", "created_by:terraform",
"env:${var.environment}", "env:${var.environment}",
"resource:redis", "resource:redis",
] ]
} }
resource "datadog_monitor" "redis_expirations" { resource "datadog_monitor" "expirations" {
name = "[${var.environment}] Redis too many expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Redis too many expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.expirations_rate_message, var.message)}" message = "${coalesce(var.expirations_rate_message, var.message)}"
@ -87,7 +86,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_blocked_clients" { resource "datadog_monitor" "blocked_clients" {
name = "[${var.environment}] Redis too many blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Redis too many blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.blocked_clients_message, var.message)}" message = "${coalesce(var.blocked_clients_message, var.message)}"
@ -128,7 +127,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_keyspace" { resource "datadog_monitor" "keyspace_full" {
name = "[${var.environment}] Redis keyspace seems full (no changes since ${var.keyspace_timeframe})" name = "[${var.environment}] Redis keyspace seems full (no changes since ${var.keyspace_timeframe})"
message = "${coalesce(var.keyspace_message, var.message)}" message = "${coalesce(var.keyspace_message, var.message)}"
@ -168,7 +167,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_mem_used" { resource "datadog_monitor" "memory_used" {
name = "[${var.environment}] Redis too many ram memory used {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Redis too many ram memory used {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.mem_used_message, var.message)}" message = "${coalesce(var.mem_used_message, var.message)}"
@ -209,7 +208,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_mem_frag" { resource "datadog_monitor" "memory_frag" {
name = "[${var.environment}] Redis memory ram fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Redis memory ram fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.mem_frag_message, var.message)}" message = "${coalesce(var.mem_frag_message, var.message)}"
@ -249,7 +248,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_rejected_con" { resource "datadog_monitor" "rejected_connections" {
name = "[${var.environment}] Redis too many rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" name = "[${var.environment}] Redis too many rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}"
message = "${coalesce(var.rejected_con_message, var.message)}" message = "${coalesce(var.rejected_con_message, var.message)}"
@ -289,7 +288,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_latency" { resource "datadog_monitor" "latency" {
name = "[${var.environment}] Redis latency is too high {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}){{/is_warning}}" name = "[${var.environment}] Redis latency is too high {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}){{/is_warning}}"
message = "${coalesce(var.latency_message, var.message)}" message = "${coalesce(var.latency_message, var.message)}"
@ -329,7 +328,7 @@ EOL
] ]
} }
resource "datadog_monitor" "redis_hitrate" { resource "datadog_monitor" "hitrate" {
name = "[${var.environment}] Redis hitrate is too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] Redis hitrate is too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.hitrate_message, var.message)}" message = "${coalesce(var.hitrate_message, var.message)}"

View File

@ -1,44 +1,44 @@
output "redis_evictedkeys_id" { output "evicted_keys_id" {
description = "id for monitor redis_evictedkeys" description = "id for monitor evicted_keys"
value = "${datadog_monitor.redis_evictedkeys.id}" value = "${datadog_monitor.evicted_keys.id}"
} }
output "redis_expirations_id" { output "expirations_id" {
description = "id for monitor redis_expirations" description = "id for monitor expirations"
value = "${datadog_monitor.redis_expirations.id}" value = "${datadog_monitor.expirations.id}"
} }
output "redis_blocked_clients_id" { output "blocked_clients_id" {
description = "id for monitor redis_blocked_clients" description = "id for monitor blocked_clients"
value = "${datadog_monitor.redis_blocked_clients.id}" value = "${datadog_monitor.blocked_clients.id}"
} }
output "redis_keyspace_id" { output "keyspace_full_id" {
description = "id for monitor redis_keyspace" description = "id for monitor keyspace_full"
value = "${datadog_monitor.redis_keyspace.id}" value = "${datadog_monitor.keyspace_full.id}"
} }
output "redis_mem_used_id" { output "memory_used_id" {
description = "id for monitor redis_mem_used" description = "id for monitor memory_used"
value = "${datadog_monitor.redis_mem_used.id}" value = "${datadog_monitor.memory_used.id}"
} }
output "redis_mem_frag_id" { output "memory_frag_id" {
description = "id for monitor redis_mem_frag" description = "id for monitor memory_frag"
value = "${datadog_monitor.redis_mem_frag.id}" value = "${datadog_monitor.memory_frag.id}"
} }
output "redis_rejected_con_id" { output "rejected_connections_id" {
description = "id for monitor redis_rejected_con" description = "id for monitor rejected_connections"
value = "${datadog_monitor.redis_rejected_con.id}" value = "${datadog_monitor.rejected_connections.id}"
} }
output "redis_latency_id" { output "latency_id" {
description = "id for monitor redis_latency" description = "id for monitor latency"
value = "${datadog_monitor.redis_latency.id}" value = "${datadog_monitor.latency.id}"
} }
output "redis_hitrate_id" { output "hitrate_id" {
description = "id for monitor redis_hitrate" description = "id for monitor hitrate"
value = "${datadog_monitor.redis_hitrate.id}" value = "${datadog_monitor.hitrate.id}"
} }