MON-76 Normalize monitors

This commit is contained in:
Laurent Piroelle 2017-11-23 17:12:16 +01:00
parent 0a4345dfa3
commit 753da11734
3 changed files with 20 additions and 35 deletions

View File

@ -8,9 +8,8 @@ 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}"
message = "${module.datadog-message-alerting.alerting-message}"
environment = "${var.environment}"
subscription_id = "${var.subscription_id}"
}
```
@ -32,15 +31,13 @@ Inputs
| 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 |
| provider | What is the monitored provider | string | azure | 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 |
| use_filter_tags | Filter the data with service tags if true | string | `true` | no |
| service | What is the monitored service | string | storage | no |
| subscription_id | Azure account id used as filter for monitors | string | - | yes |
Related documentation
---------------------

View File

@ -4,23 +4,6 @@ variable "environment" {
type = "string"
}
variable "subscription_id" {
description = "Azure account id used as filter for monitors"
type = "string"
}
variable "provider" {
description = "Cloud provider which the monitor and its based metric depend on"
type = "string"
default = "azure"
}
variable "service" {
description = "Service monitored by this set of monitors"
type = "string"
default = "storage"
}
# Global DataDog
variable "message" {
description = "Message sent when a Redis monitor is triggered"
@ -31,11 +14,16 @@ variable "delay" {
default = 600
}
variable "use_filter_tags" {
description = "Filter the data with service tags if true"
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)"

View File

@ -2,7 +2,7 @@ data "template_file" "filter" {
template = "$${filter}"
vars {
filter = "${var.use_filter_tags == "true" ? format("dd_monitoring:enabled,dd_azure_storage:enabled,env:%s", var.environment) : "subscription_id:${var.subscription_id}"}"
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_azure_redis:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
}
}
@ -14,9 +14,9 @@ resource "datadog_monitor" "status" {
avg(last_5m):avg:azure.cache_redis.status{${data.template_file.filter.rendered}} by {name,resource_group} != 1
EOF
type = "query alert"
type = "metric alert"
notify_no_data = false
notify_no_data = true
evaluation_delay = "${var.delay}"
renotify_interval = 0
notify_audit = false
@ -27,7 +27,7 @@ EOF
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
}
resource "datadog_monitor" "evictedkeys" {
@ -40,7 +40,7 @@ resource "datadog_monitor" "evictedkeys" {
) > ${var.evictedkeys_limit_threshold_critical}
EOF
type = "query alert"
type = "metric alert"
thresholds {
warning = "${var.evictedkeys_limit_threshold_warning}"
@ -58,7 +58,7 @@ EOF
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
}
resource "datadog_monitor" "percent_processor_time" {
@ -71,7 +71,7 @@ resource "datadog_monitor" "percent_processor_time" {
) > ${var.percent_processor_time_threshold_critical}
EOF
type = "query alert"
type = "metric alert"
thresholds {
warning = "${var.percent_processor_time_threshold_warning}"
@ -89,7 +89,7 @@ EOF
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
}
resource "datadog_monitor" "server_load" {
@ -102,7 +102,7 @@ resource "datadog_monitor" "server_load" {
) > ${var.server_load_rate_threshold_critical}
EOF
type = "query alert"
type = "metric alert"
thresholds {
warning = "${var.server_load_rate_threshold_warning}"
@ -120,5 +120,5 @@ EOF
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}","resource:${var.service}","team:${var.provider}"]
tags = ["env:${var.environment}", "resource:redis", "team:azure", "provider:azure"]
}