From 14ef1770c295ced4051d269c0dec66e386d6e79e Mon Sep 17 00:00:00 2001 From: xpk Date: Thu, 10 Nov 2022 17:10:45 +0800 Subject: [PATCH] DOC: updated readme with examples --- .../Monitoring.ALB/README.md | 19 ++++++++++++- .../Monitoring.ASG/README.md | 21 +++++++++++++- .../Monitoring.EC2/README.md | 28 ++++++++++++++++++- .../Monitoring.EMR/README.md | 22 ++++++++++++++- .../Monitoring.Kafka/README.md | 21 +++++++++++++- .../Monitoring.NLB/README.md | 21 +++++++++++++- .../Monitoring.OpenSearch/README.md | 24 +++++++++++++++- .../Monitoring.RDS/README.md | 27 +++++++++++++++++- .../Monitoring.Redis/README.md | 23 ++++++++++++++- 9 files changed, 197 insertions(+), 9 deletions(-) diff --git a/modules/ManagementGovernance/Monitoring.ALB/README.md b/modules/ManagementGovernance/Monitoring.ALB/README.md index 9d159af..70ab42c 100644 --- a/modules/ManagementGovernance/Monitoring.ALB/README.md +++ b/modules/ManagementGovernance/Monitoring.ALB/README.md @@ -2,4 +2,21 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "alb-arns" { + source = "../../modules/util/resource-list" + resource-type = "alb" +} + +module "alb-monitoring" { + for_each = toset(split(" ", data.external.alb-arns.result.result)) + source = "../../modules/ManagementGovernance/Monitoring.ALB" + default-tags = local.default-tags + load-balancer = each.value + threshold-HealthHostCountMin = 1 +} + +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.ASG/README.md b/modules/ManagementGovernance/Monitoring.ASG/README.md index 9d159af..d3b9c14 100644 --- a/modules/ManagementGovernance/Monitoring.ASG/README.md +++ b/modules/ManagementGovernance/Monitoring.ASG/README.md @@ -2,4 +2,23 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "asg" { + source = "../../modules/util/resource-list" + resource-type = "asg" +} + +module "asg-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.asg.result-set + source = "../../modules/ManagementGovernance/Monitoring.ASG" + default-tags = local.default-tags + asg-name = each.value + threshold-CPUUtilization = 90 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.EC2/README.md b/modules/ManagementGovernance/Monitoring.EC2/README.md index 9d159af..90d65af 100644 --- a/modules/ManagementGovernance/Monitoring.EC2/README.md +++ b/modules/ManagementGovernance/Monitoring.EC2/README.md @@ -2,4 +2,30 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +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 +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.EMR/README.md b/modules/ManagementGovernance/Monitoring.EMR/README.md index 9d159af..6d394fa 100644 --- a/modules/ManagementGovernance/Monitoring.EMR/README.md +++ b/modules/ManagementGovernance/Monitoring.EMR/README.md @@ -2,4 +2,24 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "emr-clusters" { + source = "../../modules/util/resource-list" + resource-type = "emr" +} + +module "emr-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.emr-clusters.result-set + source = "../../modules/ManagementGovernance/Monitoring.EMR" + default-tags = local.default-tags + job-flow-id = split("/", each.value)[1] + threshold-AppsPending = 2 + threshold-CapacityRemainingGB = 100 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.Kafka/README.md b/modules/ManagementGovernance/Monitoring.Kafka/README.md index 9d159af..3951397 100644 --- a/modules/ManagementGovernance/Monitoring.Kafka/README.md +++ b/modules/ManagementGovernance/Monitoring.Kafka/README.md @@ -2,4 +2,23 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "kafka-clusters" { + source = "../../modules/util/resource-list" + resource-type = "kafka" +} + +module "kafka-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.kafka-clusters.result-set + source = "../../modules/ManagementGovernance/Monitoring.Kafka" + default-tags = local.default-tags + cluster-name = each.value + threshold-ZooKeeperRequestLatencyMsMean = 30 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.NLB/README.md b/modules/ManagementGovernance/Monitoring.NLB/README.md index 9d159af..0c6f192 100644 --- a/modules/ManagementGovernance/Monitoring.NLB/README.md +++ b/modules/ManagementGovernance/Monitoring.NLB/README.md @@ -2,4 +2,23 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "nlb-arns" { + source = "../../modules/util/resource-list" + resource-type = "nlb" +} + +module "nlb-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.nlb-arns.result-set + source = "../../modules/ManagementGovernance/Monitoring.NLB" + default-tags = local.default-tags + load-balancer = each.value + threshold-HealthHostCountMin = 1 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.OpenSearch/README.md b/modules/ManagementGovernance/Monitoring.OpenSearch/README.md index 9d159af..76aaa33 100644 --- a/modules/ManagementGovernance/Monitoring.OpenSearch/README.md +++ b/modules/ManagementGovernance/Monitoring.OpenSearch/README.md @@ -2,4 +2,26 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "es-domains" { + source = "../../modules/util/resource-list" + resource-type = "opensearch" +} + +module "es-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.es-domains.result-set + source = "../../modules/ManagementGovernance/Monitoring.OpenSearch" + default-tags = local.default-tags + domain-name = each.value + threshold-CPUUtilization = 90 + threshold-IndexingLatency = 3 + threshold-SearchLatency = 3 + # threshold-KibanaHealthyNodes = 1 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.RDS/README.md b/modules/ManagementGovernance/Monitoring.RDS/README.md index 9d159af..11e162e 100644 --- a/modules/ManagementGovernance/Monitoring.RDS/README.md +++ b/modules/ManagementGovernance/Monitoring.RDS/README.md @@ -2,4 +2,29 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## 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 +} +``` \ No newline at end of file diff --git a/modules/ManagementGovernance/Monitoring.Redis/README.md b/modules/ManagementGovernance/Monitoring.Redis/README.md index 9d159af..ebc9052 100644 --- a/modules/ManagementGovernance/Monitoring.Redis/README.md +++ b/modules/ManagementGovernance/Monitoring.Redis/README.md @@ -2,4 +2,25 @@ 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. \ No newline at end of file +Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway. + +## Example +```terraform +module "redis-instances" { + source = "../../modules/util/resource-list" + resource-type = "redis" +} + +module "redis-monitoring" { + cw-alarm-prefix = local.cw-alarm-prefix + for_each = module.redis-instances.result-set + source = "../../modules/ManagementGovernance/Monitoring.Redis" + default-tags = local.default-tags + redis-cluster-id = each.value + threshold-EngineCPUUtilization = 90 + threshold-DatabaseMemoryUsagePercentage = 90 + threshold-CacheHitRate = 3 + actions-enabled = var.actions-enabled + sns-targets = var.sns-targets +} +``` \ No newline at end of file