69 lines
2.5 KiB
HCL
69 lines
2.5 KiB
HCL
resource "aws_cloudwatch_metric_alarm" "ec2-StatusCheckFailed_System" {
|
|
alarm_name = "EC2:StatusCheckFailed_System:${var.ec2-instance-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "1"
|
|
metric_name = "StatusCheckFailed_System"
|
|
period = "300"
|
|
statistic = "Maximum"
|
|
threshold = 0
|
|
alarm_description = "EC2:StatusCheckFailed_System"
|
|
namespace = "AWS/EC2"
|
|
insufficient_data_actions = []
|
|
actions_enabled = "true"
|
|
alarm_actions = [var.alarm-actions-emergency]
|
|
ok_actions = [var.alarm-actions-emergency]
|
|
dimensions = {
|
|
InstanceId = var.ec2-instance-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "ec2-StatusCheckFailed_Instance" {
|
|
alarm_name = "EC2:StatusCheckFailed_Instance:${var.ec2-instance-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "1"
|
|
metric_name = "StatusCheckFailed_Instance"
|
|
period = "300"
|
|
statistic = "Maximum"
|
|
threshold = 0
|
|
alarm_description = "EC2:StatusCheckFailed_Instance"
|
|
namespace = "AWS/EC2"
|
|
insufficient_data_actions = []
|
|
actions_enabled = "true"
|
|
alarm_actions = [var.alarm-actions-emergency]
|
|
ok_actions = [var.alarm-actions-emergency]
|
|
dimensions = {
|
|
InstanceId = var.ec2-instance-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "ec2-CPUUtilization" {
|
|
alarm_name = "EC2:CPUUtilization:${var.ec2-instance-id}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "6"
|
|
metric_name = "CPUUtilization"
|
|
period = "300"
|
|
statistic = "Average"
|
|
threshold = var.threshold-CPUUtilization
|
|
alarm_description = "EC2:CPUUtilization"
|
|
namespace = "AWS/EC2"
|
|
insufficient_data_actions = []
|
|
actions_enabled = "true"
|
|
alarm_actions = [var.alarm-actions-urgent]
|
|
ok_actions = [var.alarm-actions-urgent]
|
|
treat_missing_data = "notBreaching"
|
|
dimensions = {
|
|
InstanceId = var.ec2-instance-id
|
|
}
|
|
tags = var.default-tags
|
|
lifecycle {
|
|
ignore_changes = [tags]
|
|
}
|
|
} |