resource "aws_cloudwatch_metric_alarm" "redis-EngineCPUUtilization" { alarm_name = "${var.cw-alarm-prefix}:Redis:EngineCPUUtilization:${var.redis-cluster-id}" comparison_operator = "GreaterThanThreshold" evaluation_periods = "1" metric_name = "EngineCPUUtilization" period = "3600" statistic = "Average" threshold = var.threshold-EngineCPUUtilization alarm_description = "Redis:EngineCPUUtilization" namespace = "AWS/ElastiCache" insufficient_data_actions = [] actions_enabled = var.actions-enabled alarm_actions = [var.sns-targets.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent] dimensions = { CacheClusterId = var.redis-cluster-id } tags = var.default-tags lifecycle { ignore_changes = [tags] } } resource "aws_cloudwatch_metric_alarm" "redis-DatabaseMemoryUsagePercentage" { alarm_name = "${var.cw-alarm-prefix}:Redis:DatabaseMemoryUsagePercentage:${var.redis-cluster-id}" comparison_operator = "GreaterThanThreshold" evaluation_periods = "1" metric_name = "DatabaseMemoryUsagePercentage" period = "3600" statistic = "Average" threshold = var.threshold-DatabaseMemoryUsagePercentage alarm_description = "Redis:DatabaseMemoryUsagePercentage" namespace = "AWS/ElastiCache" insufficient_data_actions = [] actions_enabled = var.actions-enabled alarm_actions = [var.sns-targets.alarm-actions-urgent] ok_actions = [var.sns-targets.alarm-actions-urgent] dimensions = { CacheClusterId = var.redis-cluster-id } tags = var.default-tags lifecycle { ignore_changes = [tags] } } resource "aws_cloudwatch_metric_alarm" "redis-CacheHitRate" { alarm_name = "${var.cw-alarm-prefix}:Redis:CacheHitRate:${var.redis-cluster-id}" comparison_operator = "LessThanThreshold" evaluation_periods = "4" metric_name = "CacheHitRate" period = "900" statistic = "Average" threshold = var.threshold-CacheHitRate alarm_description = "Redis:CacheHitRate" namespace = "AWS/ElastiCache" insufficient_data_actions = [] actions_enabled = var.actions-enabled alarm_actions = [var.sns-targets.alarm-actions-standard] ok_actions = [var.sns-targets.alarm-actions-standard] dimensions = { CacheClusterId = var.redis-cluster-id # CacheNodeId = each.value } tags = var.default-tags lifecycle { ignore_changes = [tags] } }