-
Notifications
You must be signed in to change notification settings - Fork 3
/
cloudwatch.tf
46 lines (37 loc) · 1.57 KB
/
cloudwatch.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Cloudwatch resources inspired by https://github.com/azavea/terraform-aws-redis-elasticache
# Stubbing this out, we should have conversation about monitoring before we make this the default behavior
# For this module
/*
resource "aws_cloudwatch_metric_alarm" "cache_cpu" {
count = "${var.redis_clusters}"
alarm_name = "alarm-${var.name}-${data.aws_vpc.vpc.tags["Name"]}-CacheCluster00${count.index + 1}CPUUtilization"
alarm_description = "Redis cluster CPU utilization"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "1"
metric_name = "CPUUtilization"
namespace = "AWS/ElastiCache"
period = "300"
statistic = "Average"
threshold = "${var.alarm_cpu_threshold}"
dimensions {
CacheClusterId = "${aws_elasticache_replication_group.redis.id}-00${count.index + 1}"
}
alarm_actions = ["${var.alarm_actions}"]
}
resource "aws_cloudwatch_metric_alarm" "cache_memory" {
count = "${var.redis_clusters}"
alarm_name = "alarm-${var.name}-${data.aws_vpc.vpc.tags["Name"]}-CacheCluster00${count.index + 1}FreeableMemory"
alarm_description = "Redis cluster freeable memory"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
metric_name = "FreeableMemory"
namespace = "AWS/ElastiCache"
period = "60"
statistic = "Average"
threshold = "${var.alarm_memory_threshold}"
dimensions {
CacheClusterId = "${aws_elasticache_replication_group.redis.id}-00${count.index + 1}"
}
alarm_actions = ["${var.alarm_actions}"]
}
*/