2022-10-26 11:13:56 +08:00
|
|
|
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"
|
2022-10-25 14:21:37 +08:00
|
|
|
insufficient_data_actions = []
|
2022-10-26 11:13:56 +08:00
|
|
|
actions_enabled = var.actions-enabled
|
2022-11-10 11:16:24 +08:00
|
|
|
alarm_actions = [var.sns-targets.alarm-actions-urgent]
|
|
|
|
ok_actions = [var.sns-targets.alarm-actions-urgent]
|
2022-10-25 14:21:37 +08:00
|
|
|
dimensions = {
|
|
|
|
CacheClusterId = var.redis-cluster-id
|
|
|
|
}
|
|
|
|
tags = var.default-tags
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [tags]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 11:13:56 +08:00
|
|
|
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"
|
2022-10-25 14:21:37 +08:00
|
|
|
insufficient_data_actions = []
|
2022-10-26 11:13:56 +08:00
|
|
|
actions_enabled = var.actions-enabled
|
2022-11-10 11:16:24 +08:00
|
|
|
alarm_actions = [var.sns-targets.alarm-actions-urgent]
|
|
|
|
ok_actions = [var.sns-targets.alarm-actions-urgent]
|
2022-10-25 14:21:37 +08:00
|
|
|
dimensions = {
|
|
|
|
CacheClusterId = var.redis-cluster-id
|
|
|
|
}
|
|
|
|
tags = var.default-tags
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [tags]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 11:13:56 +08:00
|
|
|
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"
|
2022-10-25 14:21:37 +08:00
|
|
|
insufficient_data_actions = []
|
2022-10-26 11:13:56 +08:00
|
|
|
actions_enabled = var.actions-enabled
|
2022-11-10 11:16:24 +08:00
|
|
|
alarm_actions = [var.sns-targets.alarm-actions-standard]
|
|
|
|
ok_actions = [var.sns-targets.alarm-actions-standard]
|
2022-10-25 14:21:37 +08:00
|
|
|
dimensions = {
|
|
|
|
CacheClusterId = var.redis-cluster-id
|
|
|
|
# CacheNodeId = each.value
|
|
|
|
}
|
|
|
|
tags = var.default-tags
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [tags]
|
|
|
|
}
|
|
|
|
}
|