2022-10-26 11:13:56 +08:00
|
|
|
resource "aws_cloudwatch_metric_alarm" "asg-CPUUtilization" {
|
|
|
|
alarm_name = "${var.cw-alarm-prefix}:ASG:CPUUtilization:${var.asg-name}"
|
2023-01-05 23:35:31 +08:00
|
|
|
comparison_operator = var.settings.CPUUtilization.comparison_operator
|
|
|
|
evaluation_periods = var.settings.CPUUtilization.evaluation_periods
|
2022-10-26 11:13:56 +08:00
|
|
|
metric_name = "CPUUtilization"
|
2023-01-05 23:35:31 +08:00
|
|
|
period = var.settings.CPUUtilization.period
|
|
|
|
statistic = var.settings.CPUUtilization.statistic
|
|
|
|
threshold = var.settings.CPUUtilization.threshold
|
2022-10-26 11:13:56 +08:00
|
|
|
alarm_description = "ASG:CPUUtilization"
|
|
|
|
namespace = "AWS/EC2"
|
|
|
|
insufficient_data_actions = []
|
|
|
|
actions_enabled = var.actions-enabled
|
2023-01-05 23:35:31 +08:00
|
|
|
alarm_actions = [var.settings.CPUUtilization.action]
|
|
|
|
ok_actions = [var.settings.CPUUtilization.action]
|
2022-10-26 11:13:56 +08:00
|
|
|
dimensions = {
|
|
|
|
AutoScalingGroupName = var.asg-name
|
|
|
|
}
|
|
|
|
tags = var.default-tags
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [tags]
|
|
|
|
}
|
|
|
|
}
|