75 lines
2.3 KiB
HCL
75 lines
2.3 KiB
HCL
resource aws_cloudwatch_metric_alarm redis-EngineCPUUtilization {
|
|
alarm_name = "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 = "true"
|
|
alarm_actions = [var.alarm-actions-urgent]
|
|
ok_actions = [var.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 = "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 = "true"
|
|
alarm_actions = [var.alarm-actions-urgent]
|
|
ok_actions = [var.alarm-actions-urgent]
|
|
dimensions = {
|
|
CacheClusterId = var.redis-cluster-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
/*
|
|
data aws_elasticache_cluster redis-cluster {
|
|
cluster_id = var.redis-cluster-id
|
|
}
|
|
*/
|
|
resource aws_cloudwatch_metric_alarm redis-CacheHitRate {
|
|
# for_each = toset(data.aws_elasticache_cluster.redis-cluster.cache_nodes.*.id)
|
|
alarm_name = "Redis:CacheHitRate:${var.redis-cluster-id}"
|
|
comparison_operator = "LessThanThreshold"
|
|
evaluation_periods = "1"
|
|
metric_name = "CacheHitRate"
|
|
period = "1800"
|
|
statistic = "Average"
|
|
threshold = var.threshold-CacheHitRate
|
|
alarm_description = "Redis:CacheHitRate"
|
|
namespace = "AWS/ElastiCache"
|
|
insufficient_data_actions = []
|
|
actions_enabled = "true"
|
|
alarm_actions = [var.alarm-actions-standard]
|
|
ok_actions = [var.alarm-actions-standard]
|
|
dimensions = {
|
|
CacheClusterId = var.redis-cluster-id
|
|
# CacheNodeId = each.value
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
} |