Merged in MON-122-add-aurora-monitors (pull request #96)
MON-122 Add Aurora replica lag monitor Approved-by: David Drugeon-Hamon <david.drugeon.hamon@fr.clara.net> Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr> Approved-by: Rafael Romero Carmona <rafael.romero.carmona@fr.clara.net> Approved-by: Guillaume Kérivel <guillaume.kerivel@fr.clara.net>
This commit is contained in:
commit
a7cf5a2530
@ -84,6 +84,10 @@ The `//` is very important, it's a terraform specific syntax used to separate gi
|
||||
- [elb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/elb/)
|
||||
- [kinesis-firehose](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/kinesis-firehose/)
|
||||
- [rds](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/)
|
||||
- [aurora](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/aurora/)
|
||||
- [mysql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/aurora/mysql/)
|
||||
- [postgresql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/aurora/postgresql/)
|
||||
- [common](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/common/)
|
||||
- [vpn](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/vpn/)
|
||||
- [azure](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/)
|
||||
- [apimanagement](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/apimanagement/)
|
||||
|
||||
@ -2,7 +2,7 @@ module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "alb"
|
||||
resource = "aws_alb"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "elasticsearch"
|
||||
resource = "aws_elasticsearch"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "elb"
|
||||
resource = "aws_elb"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "kinesis-firehose"
|
||||
resource = "aws_kinesis-firehose"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
|
||||
46
cloud/aws/rds/aurora/mysql/README.md
Normal file
46
cloud/aws/rds/aurora/mysql/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# CLOUD AWS RDS AURORA MYSQL DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-cloud-aws-rds-aurora-mysql" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/rds/aurora/mysql?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- RDS Aurora Mysql replica lag
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| aurora_replicalag_enabled | Flag to enable RDS Aurora replica lag monitor | string | `true` | no |
|
||||
| aurora_replicalag_extra_tags | Extra tags for RDS Aurora replica lag monitor | list | `<list>` | no |
|
||||
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
||||
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | 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_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 | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | 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 an alert is triggered | string | - | yes |
|
||||
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| rds_aurora_mysql_replica_lag_id | id for monitor rds_aurora_mysql_replica_lag |
|
||||
|
||||
## Related documentation
|
||||
|
||||
72
cloud/aws/rds/aurora/mysql/inputs.tf
Normal file
72
cloud/aws/rds/aurora/mysql/inputs.tf
Normal file
@ -0,0 +1,72 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture Environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds before monitor new resource"
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "message" {
|
||||
description = "Message sent when an alert is triggered"
|
||||
}
|
||||
|
||||
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 = "*"
|
||||
}
|
||||
|
||||
# AWS RDS Aurora instance specific
|
||||
|
||||
variable "aurora_replicalag_silenced" {
|
||||
description = "Groups to mute for RDS Aurora replica lag monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_enabled" {
|
||||
description = "Flag to enable RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_extra_tags" {
|
||||
description = "Extra tags for RDS Aurora replica lag monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_message" {
|
||||
description = "Custom message for RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
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"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_threshold_warning" {
|
||||
description = "Aurora replica lag in milliseconds (warning threshold)"
|
||||
default = "100"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_threshold_critical" {
|
||||
description = "Aurora replica lag in milliseconds (critical threshold)"
|
||||
default = "200"
|
||||
}
|
||||
8
cloud/aws/rds/aurora/mysql/modules.tf
Normal file
8
cloud/aws/rds/aurora/mysql/modules.tf
Normal file
@ -0,0 +1,8 @@
|
||||
module "filter-tags" {
|
||||
source = "../../../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "aws_rds"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
32
cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf
Normal file
32
cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf
Normal file
@ -0,0 +1,32 @@
|
||||
### RDS Aurora Mysql Replica Lag monitor ###
|
||||
resource "datadog_monitor" "rds_aurora_mysql_replica_lag" {
|
||||
count = "${var.aurora_replicalag_enabled ? 1 : 0}"
|
||||
name = "[${var.environment}] RDS Aurora Mysql replica lag {{#is_alert}}{{{comparator}}} {{threshold}} ms ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ms ({{value}}%){{/is_warning}}"
|
||||
message = "${coalesce(var.aurora_replicalag_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.aurora_replicalag_timeframe}): (
|
||||
avg:aws.rds.aurora_replica_lag${module.filter-tags.query_alert} by {region,name}
|
||||
) > ${var.aurora_replicalag_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.aurora_replicalag_threshold_warning}"
|
||||
critical = "${var.aurora_replicalag_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.aurora_replicalag_silenced}"
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform", "${var.aurora_replicalag_extra_tags}"]
|
||||
}
|
||||
4
cloud/aws/rds/aurora/mysql/outputs.tf
Normal file
4
cloud/aws/rds/aurora/mysql/outputs.tf
Normal file
@ -0,0 +1,4 @@
|
||||
output "rds_aurora_mysql_replica_lag_id" {
|
||||
description = "id for monitor rds_aurora_mysql_replica_lag"
|
||||
value = "${datadog_monitor.rds_aurora_mysql_replica_lag.*.id}"
|
||||
}
|
||||
46
cloud/aws/rds/aurora/postgresql/README.md
Normal file
46
cloud/aws/rds/aurora/postgresql/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# CLOUD AWS RDS AURORA POSTGRESQL DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-cloud-aws-rds-aurora-postgresql" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/rds/aurora/postgresql?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- RDS Aurora PostgreSQL replica lag
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| aurora_replicalag_enabled | Flag to enable RDS Aurora replica lag monitor | string | `true` | no |
|
||||
| aurora_replicalag_extra_tags | Extra tags for RDS Aurora replica lag monitor | list | `<list>` | no |
|
||||
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
||||
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | 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_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 | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | 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 an alert is triggered | string | - | yes |
|
||||
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| rds_aurora_postgresql_replica_lag_id | id for monitor rds_aurora_postgresql_replica_lag |
|
||||
|
||||
## Related documentation
|
||||
|
||||
72
cloud/aws/rds/aurora/postgresql/inputs.tf
Normal file
72
cloud/aws/rds/aurora/postgresql/inputs.tf
Normal file
@ -0,0 +1,72 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture Environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds before monitor new resource"
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "message" {
|
||||
description = "Message sent when an alert is triggered"
|
||||
}
|
||||
|
||||
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 = "*"
|
||||
}
|
||||
|
||||
# AWS RDS Aurora instance specific
|
||||
|
||||
variable "aurora_replicalag_silenced" {
|
||||
description = "Groups to mute for RDS Aurora replica lag monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_enabled" {
|
||||
description = "Flag to enable RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_extra_tags" {
|
||||
description = "Extra tags for RDS Aurora replica lag monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_message" {
|
||||
description = "Custom message for RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
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"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_threshold_warning" {
|
||||
description = "Aurora replica lag in milliseconds (warning threshold)"
|
||||
default = "100"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_threshold_critical" {
|
||||
description = "Aurora replica lag in milliseconds (critical threshold)"
|
||||
default = "200"
|
||||
}
|
||||
8
cloud/aws/rds/aurora/postgresql/modules.tf
Normal file
8
cloud/aws/rds/aurora/postgresql/modules.tf
Normal file
@ -0,0 +1,8 @@
|
||||
module "filter-tags" {
|
||||
source = "../../../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "aws_rds"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
### RDS Aurora Postgresql Replica Lag monitor ###
|
||||
resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" {
|
||||
count = "${var.aurora_replicalag_enabled ? 1 : 0}"
|
||||
name = "[${var.environment}] RDS Aurora PostgreSQL replica lag {{#is_alert}}{{{comparator}}} {{threshold}} ms ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ms ({{value}}%){{/is_warning}}"
|
||||
message = "${coalesce(var.aurora_replicalag_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${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}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.aurora_replicalag_threshold_warning}"
|
||||
critical = "${var.aurora_replicalag_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.aurora_replicalag_silenced}"
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform", "${var.aurora_replicalag_extra_tags}"]
|
||||
}
|
||||
4
cloud/aws/rds/aurora/postgresql/outputs.tf
Normal file
4
cloud/aws/rds/aurora/postgresql/outputs.tf
Normal file
@ -0,0 +1,4 @@
|
||||
output "rds_aurora_postgresql_replica_lag_id" {
|
||||
description = "id for monitor rds_aurora_postgresql_replica_lag"
|
||||
value = "${datadog_monitor.rds_aurora_postgresql_replica_lag.*.id}"
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
# CLOUD AWS RDS DataDog monitors
|
||||
# CLOUD AWS RDS COMMON DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-cloud-aws-rds" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/rds?ref={revision}"
|
||||
module "datadog-monitors-cloud-aws-rds-common" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/rds/common?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
@ -18,6 +18,7 @@ Creates DataDog monitors with the following checks:
|
||||
|
||||
- RDS instance CPU high
|
||||
- RDS instance free space
|
||||
- RDS replica lag
|
||||
|
||||
## Inputs
|
||||
|
||||
@ -45,6 +46,13 @@ Creates DataDog monitors with the following checks:
|
||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||
| message | Message sent when an alert is triggered | string | - | yes |
|
||||
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
||||
| replicalag_enabled | Flag to enable RDS replica lag monitor | string | `true` | no |
|
||||
| replicalag_extra_tags | Extra tags for RDS replica lag monitor | list | `<list>` | no |
|
||||
| replicalag_message | Custom message for RDS replica lag monitor | string | `` | no |
|
||||
| replicalag_silenced | Groups to mute for RDS replica lag monitor | map | `<map>` | 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_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
|
||||
|
||||
@ -52,9 +60,11 @@ Creates DataDog monitors with the following checks:
|
||||
|------|-------------|
|
||||
| rds_cpu_90_15min_id | id for monitor rds_cpu_90_15min |
|
||||
| rds_free_space_low_id | id for monitor rds_free_space_low |
|
||||
| rds_replica_lag_id | id for monitor rds_replica_lag |
|
||||
|
||||
## 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/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html)
|
||||
|
||||
@ -122,3 +122,43 @@ variable "diskspace_threshold_critical" {
|
||||
description = "Disk free space in percent (critical threshold)"
|
||||
default = "10"
|
||||
}
|
||||
|
||||
variable "replicalag_silenced" {
|
||||
description = "Groups to mute for RDS replica lag monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "replicalag_enabled" {
|
||||
description = "Flag to enable RDS replica lag monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "replicalag_extra_tags" {
|
||||
description = "Extra tags for RDS replica lag monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "replicalag_message" {
|
||||
description = "Custom message for RDS replica lag monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
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"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "replicalag_threshold_warning" {
|
||||
description = "replica lag in seconds (warning threshold)"
|
||||
default = "200"
|
||||
}
|
||||
|
||||
variable "replicalag_threshold_critical" {
|
||||
description = "replica lag in seconds (critical threshold)"
|
||||
default = "300"
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
source = "../../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "rds"
|
||||
resource = "aws_rds"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
@ -64,3 +64,36 @@ EOF
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"]
|
||||
}
|
||||
|
||||
### RDS Replica Lag monitor ###
|
||||
resource "datadog_monitor" "rds_replica_lag" {
|
||||
count = "${var.replicalag_enabled ? 1 : 0}"
|
||||
name = "[${var.environment}] RDS replica lag {{#is_alert}}{{{comparator}}} {{threshold}} ms ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ms ({{value}}%){{/is_warning}}"
|
||||
message = "${coalesce(var.replicalag_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.replicalag_timeframe}): (
|
||||
avg:aws.rds.replica_lag${module.filter-tags.query_alert} by {region,name}
|
||||
) > ${var.replicalag_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.replicalag_threshold_warning}"
|
||||
critical = "${var.replicalag_threshold_critical}"
|
||||
}
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.replicalag_silenced}"
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.replicalag_extra_tags}"]
|
||||
}
|
||||
@ -7,3 +7,8 @@ output "rds_free_space_low_id" {
|
||||
description = "id for monitor rds_free_space_low"
|
||||
value = "${datadog_monitor.rds_free_space_low.*.id}"
|
||||
}
|
||||
|
||||
output "rds_replica_lag_id" {
|
||||
description = "id for monitor rds_replica_lag"
|
||||
value = "${datadog_monitor.rds_replica_lag.*.id}"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user