terraform.aws-baseline-infra/modules/ManagementGovernance/Monitoring.EC2
2022-11-21 14:55:32 +08:00
..
get-cwagent-device.sh NEW: cwagent external datasource and ec2 monitoring 2022-11-03 11:39:31 +08:00
get-cwagent-dimensions.sh UPD: refactored cw dimension detection 2022-11-14 09:41:12 +08:00
get-os-platform.sh NEW: external data source for identifying EC2 OS platform 2022-11-10 14:04:44 +08:00
main.tf UPD: removed checks specified by customer, add checks from default CW agent config 2022-11-21 14:55:32 +08:00
provider.tf NEW: cloudwatch modules for various resource monitoring 2022-10-25 14:21:37 +08:00
README.md DOC: updated readme with examples 2022-11-10 17:10:45 +08:00
variables.tf UPD: removed checks specified by customer, add checks from default CW agent config 2022-11-21 14:55:32 +08:00

Monitoring module

This module deploys the default cloudwatch metric monitoring

Notes

Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway.

Example

module "ec2-instances" {
  source        = "../../modules/util/resource-list"
  resource-type = "ec2"
}

module "ec2-monitoring" {
  cw-alarm-prefix            = local.cw-alarm-prefix
  for_each                   = module.ec2-instances.result-set
  source                     = "../../modules/ManagementGovernance/Monitoring.EC2"
  default-tags               = local.default-tags
  ec2-instance-id            = each.value
  threshold-CPUUtilization   = 90
  threshold-mem_free         = 100000
  threshold-swap_free        = 100000
  threshold-disk_free        = 1 * 1000 * 1000 * 1000
  threshold-disk_inodes_free = 10000
  threshold-processes_total  = 500
  threshold-LogicalDiskFreePct = 10
  threshold-MemoryCommittedPct = 90
  actions-enabled            = var.actions-enabled
  sns-targets = var.sns-targets
}