Merge branch 'MON-531_Add_time_aggregator_on_replica_lag_monitor' into 'master'

MON-531: Add replicalag time aggregator input variable

Closes MON-531

See merge request claranet/pt-monitoring/projects/datadog/terraform/monitors!139
This commit is contained in:
Quentin Manfroi 2019-11-14 15:06:45 +01:00
commit decddd57bd
9 changed files with 31 additions and 8 deletions

View File

@ -27,6 +27,7 @@ Creates DataDog monitors with the following checks:
| aurora\_replicalag\_message | Custom message for RDS Aurora replica lag monitor | string | `""` | no |
| aurora\_replicalag\_threshold\_critical | Aurora replica lag in milliseconds (critical threshold) | string | `"200"` | no |
| aurora\_replicalag\_threshold\_warning | Aurora replica lag in milliseconds (warning threshold) | string | `"100"` | no |
| aurora\_replicalag\_time\_aggregator | Monitor aggregator for RDS Aurora replica lag [available values: min, max or avg] | string | `"min"` | no |
| aurora\_replicalag\_timeframe | Monitor timeframe for RDS Aurora replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no |
| environment | Architecture Environment | string | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"900"` | no |
@ -45,3 +46,6 @@ Creates DataDog monitors with the following checks:
## Related documentation
DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_rds/](https://docs.datadoghq.com/integrations/amazon_rds/)
AWS RDS Instance metrics documentation: [https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch)

View File

@ -59,6 +59,12 @@ variable "aurora_replicalag_message" {
default = ""
}
variable "aurora_replicalag_time_aggregator" {
description = "Monitor aggregator for RDS Aurora replica lag [available values: min, max or avg]"
type = string
default = "min"
}
variable "aurora_replicalag_timeframe" {
description = "Monitor timeframe for RDS Aurora replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = string
@ -74,4 +80,3 @@ variable "aurora_replicalag_threshold_critical" {
description = "Aurora replica lag in milliseconds (critical threshold)"
default = "200"
}

View File

@ -6,7 +6,7 @@ resource "datadog_monitor" "rds_aurora_mysql_replica_lag" {
type = "query alert"
query = <<EOQ
avg(${var.aurora_replicalag_timeframe}): (
${var.aurora_replicalag_time_aggregator}(${var.aurora_replicalag_timeframe}): (
avg:aws.rds.aurora_replica_lag${module.filter-tags.query_alert} by {region,name}
) > ${var.aurora_replicalag_threshold_critical}
EOQ

View File

@ -27,6 +27,7 @@ Creates DataDog monitors with the following checks:
| aurora\_replicalag\_message | Custom message for RDS Aurora replica lag monitor | string | `""` | no |
| aurora\_replicalag\_threshold\_critical | Aurora replica lag in milliseconds (critical threshold) | string | `"200"` | no |
| aurora\_replicalag\_threshold\_warning | Aurora replica lag in milliseconds (warning threshold) | string | `"100"` | no |
| aurora\_replicalag\_time\_aggregator | Monitor aggregator for RDS Aurora replica lag [available values: min, max or avg] | string | `"min"` | no |
| aurora\_replicalag\_timeframe | Monitor timeframe for RDS Aurora replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no |
| environment | Architecture Environment | string | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"900"` | no |
@ -45,3 +46,6 @@ Creates DataDog monitors with the following checks:
## Related documentation
DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_rds/](https://docs.datadoghq.com/integrations/amazon_rds/)
AWS RDS Instance metrics documentation: [https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch)

View File

@ -59,6 +59,12 @@ variable "aurora_replicalag_message" {
default = ""
}
variable "aurora_replicalag_time_aggregator" {
description = "Monitor aggregator for RDS Aurora replica lag [available values: min, max or avg]"
type = string
default = "min"
}
variable "aurora_replicalag_timeframe" {
description = "Monitor timeframe for RDS Aurora replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = string
@ -74,4 +80,3 @@ variable "aurora_replicalag_threshold_critical" {
description = "Aurora replica lag in milliseconds (critical threshold)"
default = "200"
}

View File

@ -6,7 +6,7 @@ resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" {
type = "query alert"
query = <<EOQ
avg(${var.aurora_replicalag_timeframe}): (
${var.aurora_replicalag_time_aggregator}(${var.aurora_replicalag_timeframe}): (
avg:aws.rds.rdsto_aurora_postgre_sqlreplica_lag${module.filter-tags.query_alert} by {region,name}
) > ${var.aurora_replicalag_threshold_critical}
EOQ

View File

@ -51,6 +51,7 @@ Creates DataDog monitors with the following checks:
| replicalag\_message | Custom message for RDS replica lag monitor | string | `""` | no |
| replicalag\_threshold\_critical | replica lag in seconds (critical threshold) | string | `"300"` | no |
| replicalag\_threshold\_warning | replica lag in seconds (warning threshold) | string | `"200"` | no |
| replicalag\_time\_aggregator | Monitor aggregator for RDS replica lag [available values: min, max or avg] | string | `"min"` | no |
| replicalag\_timeframe | Monitor timeframe for RDS replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no |
## Outputs
@ -65,5 +66,4 @@ Creates DataDog monitors with the following checks:
DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_rds/](https://docs.datadoghq.com/integrations/amazon_rds/)
AWS RDS Instance metrics documentation: [https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html)
AWS RDS Instance metrics documentation: [https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MonitoringOverview.html#monitoring-cloudwatch)

View File

@ -139,6 +139,12 @@ variable "replicalag_message" {
default = ""
}
variable "replicalag_time_aggregator" {
description = "Monitor aggregator for RDS replica lag [available values: min, max or avg]"
type = string
default = "min"
}
variable "replicalag_timeframe" {
description = "Monitor timeframe for RDS replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = string
@ -154,4 +160,3 @@ variable "replicalag_threshold_critical" {
description = "replica lag in seconds (critical threshold)"
default = "300"
}

View File

@ -75,7 +75,7 @@ resource "datadog_monitor" "rds_replica_lag" {
type = "query alert"
query = <<EOQ
avg(${var.replicalag_timeframe}): (
${var.replicalag_time_aggregator}(${var.replicalag_timeframe}): (
avg:aws.rds.replica_lag${module.filter-tags.query_alert} by {region,name}
) > ${var.replicalag_threshold_critical}
EOQ