-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalarm.tf
31 lines (30 loc) · 1.04 KB
/
alarm.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
resource "aws_cloudwatch_metric_alarm" "cpu_high_alarm" {
alarm_name = "HighCPUUsage"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 10
metric_name = "CPUActive"
namespace = "Compute/Tidybase"
alarm_actions = [aws_sns_topic.scale_up_topic.arn]
period = 30
statistic = "Average"
threshold = 70
treat_missing_data = "notBreaching"
dimensions = {
AutoScalingGroupName = aws_autoscaling_group.tidybase_small_asg.name
}
}
resource "aws_cloudwatch_metric_alarm" "cpu_low_alarm" {
alarm_name = "LowCPUAlarm"
comparison_operator = "LessThanThreshold"
evaluation_periods = 10
metric_name = "CPUActive"
namespace = "Compute/Tidybase"
alarm_actions = [aws_sns_topic.scale_down_topic.arn]
period = 30
statistic = "Average"
threshold = 20
treat_missing_data = "notBreaching"
dimensions = {
AutoScalingGroupName = aws_autoscaling_group.tidybase_large_asg.name
}
}