Terraform resource: aws cloudwatch metric alarm
Jump to navigation
Jump to search
resource "aws_cloudwatch_metric_alarm" "db_cpu_utilization_too_high" { alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-highCPUUtilization") comparison_operator = "GreaterThanThreshold" evaluation_periods = "5" metric_name = "CPUUtilization" namespace = "AWS/RDS" period = "120" statistic = "Average" threshold = "80" alarm_description = "Average database CPU utilization is too high." dimensions = { DBInstanceIdentifier = aws_db_instance.rds_instance.id } } resource "aws_cloudwatch_metric_alarm" "db_disk_queue_depth_too_high" { alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-highDiskQueueDepth") comparison_operator = "GreaterThanThreshold" evaluation_periods = "2" metric_name = "DiskQueueDepth" namespace = "AWS/RDS" period = "120" statistic = "Average" threshold = "10" alarm_description = "Average database disk queue depth is too high, performance may be negatively impacted." dimensions = { DBInstanceIdentifier = aws_db_instance.rds_instance.id } } resource "aws_cloudwatch_metric_alarm" "db_disk_free_storage_space_too_low" { alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeStorageSpace") comparison_operator = "LessThanThreshold" evaluation_periods = "2" metric_name = "FreeStorageSpace" namespace = "AWS/RDS" period = "120" statistic = "Average" threshold = "10" alarm_description = "Average database free storage space is too low and may fill up soon." dimensions = { DBInstanceIdentifier = aws_db_instance.rds_instance.id } } resource "aws_cloudwatch_metric_alarm" "db_memory_freeable_too_low" { alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeableMemory") comparison_operator = "LessThanThreshold" evaluation_periods = "2" metric_name = "FreeableMemory" namespace = "AWS/RDS" period = "120" statistic = "Average" threshold = "10" alarm_description = "Average database freeable memory is too low, performance may be negatively impacted." dimensions = { DBInstanceIdentifier = aws_db_instance.rds_instance.id } }
Related
See also
Advertising: