2022-11-03 21:16:35 +08:00
|
|
|
# Monitoring module
|
2022-10-25 14:21:37 +08:00
|
|
|
This module deploys the default cloudwatch metric monitoring
|
|
|
|
|
|
|
|
## Notes
|
2022-11-10 17:10:45 +08:00
|
|
|
Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway.
|
2023-05-23 13:10:16 +08:00
|
|
|
AWS provider 4.47.0 or above is needed for datasource aws_db_instances (https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md)
|
2022-11-10 17:10:45 +08:00
|
|
|
|
|
|
|
## Example
|
|
|
|
```terraform
|
|
|
|
module "rds-instances" {
|
|
|
|
source = "../../modules/util/resource-list"
|
|
|
|
resource-type = "rds"
|
|
|
|
}
|
|
|
|
|
|
|
|
module "rds-monitoring" {
|
|
|
|
# for_each = toset(var.rds-instance-ids)
|
|
|
|
cw-alarm-prefix = local.cw-alarm-prefix
|
|
|
|
for_each = module.rds-instances.result-set
|
|
|
|
source = "../../modules/ManagementGovernance/Monitoring.RDS"
|
|
|
|
default-tags = local.default-tags
|
|
|
|
rds-instance-name = each.value
|
|
|
|
threshold-CpuUtilization = 90
|
|
|
|
threshold-FreeableMemory = 512 * 1024 * 1024
|
|
|
|
threshold-FreeStorageSpace = 5 * 1024 * 1024 * 1024
|
|
|
|
threshold-DiskQueueDepth = 30
|
|
|
|
threshold-ReadLatency = 0.03
|
|
|
|
threshold-WriteLatency = 0.03
|
|
|
|
actions-enabled = var.actions-enabled
|
|
|
|
sns-targets = var.sns-targets
|
|
|
|
}
|
|
|
|
```
|