MON-122 update to new best practices
This commit is contained in:
parent
81c523743b
commit
bc0a2e0ceb
@ -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/)
|
||||
|
||||
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 CPU usage monitor | string | `true` | no |
|
||||
| aurora_replicalag_extra_tags | Extra tags for RDS CPU usage 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
|
||||
|
||||
@ -37,6 +37,18 @@ variable "aurora_replicalag_silenced" {
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_enabled" {
|
||||
description = "Flag to enable RDS CPU usage monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_extra_tags" {
|
||||
description = "Extra tags for RDS CPU usage monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_message" {
|
||||
description = "Custom message for RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
@ -58,4 +70,3 @@ 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 = "rds"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
### 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)}"
|
||||
|
||||
@ -7,7 +8,7 @@ resource "datadog_monitor" "rds_aurora_mysql_replica_lag" {
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.aurora_replicalag_timeframe}): (
|
||||
avg:aws.rds.aws.rds.aurora_replica_lag{${data.template_file.filter.rendered}} by {region,name}
|
||||
avg:aws.rds.aws.rds.aurora_replica_lag${module.filter-tags.query_alert} by {region,name}
|
||||
) > ${var.aurora_replicalag_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -17,18 +18,15 @@ EOF
|
||||
}
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.aurora_replicalag_silenced}"
|
||||
|
||||
tags = ["env:${var.environment}", "resource:rds", "team:aws", "provider:aws"]
|
||||
|
||||
count = "${var.aurora_cluster_type == "mysql" ? 1 : 0}"
|
||||
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 CPU usage monitor | string | `true` | no |
|
||||
| aurora_replicalag_extra_tags | Extra tags for RDS CPU usage 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
|
||||
|
||||
@ -37,6 +37,18 @@ variable "aurora_replicalag_silenced" {
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_enabled" {
|
||||
description = "Flag to enable RDS CPU usage monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_extra_tags" {
|
||||
description = "Extra tags for RDS CPU usage monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aurora_replicalag_message" {
|
||||
description = "Custom message for RDS Aurora replica lag monitor"
|
||||
type = "string"
|
||||
@ -58,4 +70,3 @@ 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 = "rds"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
### 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)}"
|
||||
|
||||
@ -7,7 +8,7 @@ resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" {
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.aurora_replicalag_timeframe}): (
|
||||
avg:aws.rds.rdsto_aurora_postgre_sqlreplica_lag{${data.template_file.filter.rendered}} by {region,name}
|
||||
avg:aws.rds.rdsto_aurora_postgre_sqlreplica_lag${module.filter-tags.query_alert} by {region,name}
|
||||
) > ${var.aurora_replicalag_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -17,19 +18,15 @@ EOF
|
||||
}
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.aurora_replicalag_silenced}"
|
||||
|
||||
tags = ["env:${var.environment}", "resource:rds", "team:aws", "provider:aws"]
|
||||
|
||||
count = "${var.aurora_cluster_type == "postgresql" ? 1 : 0}"
|
||||
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}"
|
||||
|
||||
@ -122,4 +122,3 @@ variable "diskspace_threshold_critical" {
|
||||
description = "Disk free space in percent (critical threshold)"
|
||||
default = "10"
|
||||
}
|
||||
|
||||
|
||||
@ -6,4 +6,3 @@ module "filter-tags" {
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
}
|
||||
|
||||
|
||||
@ -64,4 +64,3 @@ EOF
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"]
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user