-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
alarms.tf
46 lines (41 loc) · 1.72 KB
/
alarms.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
locals {
thresholds = {
BurstCreditBalanceThreshold = "${max(var.burst_credit_balance_threshold, 0)}"
PercentIOLimitThreshold = "${min(max(var.percent_io_limit_threshold, 0), 100)}"
}
alert_for = "efs"
sns_topic_arn = var.sns_topic_arn == "" ? aws_sns_topic.default.arn : var.sns_topic_arn
endpoints = distinct(compact(concat(list(local.sns_topic_arn), var.additional_endpoint_arns)))
}
resource "aws_cloudwatch_metric_alarm" "burst_credit_balance_too_low" {
alarm_name = "burst_credit_balance_too_low"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
metric_name = "BurstCreditBalance"
namespace = "AWS/EFS"
period = "600"
statistic = "Average"
threshold = local.thresholds["BurstCreditBalanceThreshold"]
alarm_description = "Average burst credit balance over last 10 minutes too low, expect a significant performance drop soon"
alarm_actions = ["${local.endpoints}"]
ok_actions = ["${local.endpoints}"]
dimensions {
FileSystemId = var.filesystem_id
}
}
resource "aws_cloudwatch_metric_alarm" "percent_io_limit_too_high" {
alarm_name = "percent_io_limit_too_high"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "3"
metric_name = "PercentIOLimit"
namespace = "AWS/EFS"
period = "600"
statistic = "Maximum"
threshold = local.thresholds["PercentIOLimitThreshold"]
alarm_description = "I/O limit has been reached, consider using Max I/O performance mode"
alarm_actions = ["${local.endpoints}"]
ok_actions = ["${local.endpoints}"]
dimensions {
FileSystemId = var.filesystem_id
}
}