91 lines
2.6 KiB
Terraform
91 lines
2.6 KiB
Terraform
|
resource aws_cloudwatch_metric_alarm rds-cpu {
|
||
|
alarm_name = "RDS:CpuUtilization:${var.rds-instance-name}"
|
||
|
comparison_operator = "GreaterThanThreshold"
|
||
|
evaluation_periods = "1"
|
||
|
metric_name = "CPUUtilization"
|
||
|
period = "3600"
|
||
|
statistic = "Average"
|
||
|
threshold = var.threshold-CpuUtilization
|
||
|
alarm_description = "RDS:CpuUtilization"
|
||
|
namespace = "AWS/RDS"
|
||
|
insufficient_data_actions = []
|
||
|
actions_enabled = "true"
|
||
|
alarm_actions = [var.alarm-actions-urgent]
|
||
|
ok_actions = [var.alarm-actions-urgent]
|
||
|
dimensions = {
|
||
|
DBInstanceIdentifier = var.rds-instance-name
|
||
|
}
|
||
|
tags = var.default-tags
|
||
|
lifecycle {
|
||
|
ignore_changes = [tags]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource aws_cloudwatch_metric_alarm rds-storage {
|
||
|
alarm_name = "RDS:FreeStorageSpace:${var.rds-instance-name}"
|
||
|
comparison_operator = "LessThanThreshold"
|
||
|
evaluation_periods = "1"
|
||
|
metric_name = "FreeStorageSpace"
|
||
|
period = "3600"
|
||
|
statistic = "Average"
|
||
|
threshold = var.threshold-FreeStorageSpace
|
||
|
alarm_description = "RDS:FreeStorageSpace"
|
||
|
namespace = "AWS/RDS"
|
||
|
insufficient_data_actions = []
|
||
|
actions_enabled = "true"
|
||
|
alarm_actions = [var.alarm-actions-urgent]
|
||
|
ok_actions = [var.alarm-actions-urgent]
|
||
|
dimensions = {
|
||
|
DBInstanceIdentifier = var.rds-instance-name
|
||
|
}
|
||
|
tags = var.default-tags
|
||
|
lifecycle {
|
||
|
ignore_changes = [tags]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource aws_cloudwatch_metric_alarm rds-memory {
|
||
|
alarm_name = "RDS:FreeableMemory:${var.rds-instance-name}"
|
||
|
comparison_operator = "LessThanThreshold"
|
||
|
evaluation_periods = "1"
|
||
|
metric_name = "FreeableMemory"
|
||
|
period = "3600"
|
||
|
statistic = "Average"
|
||
|
threshold = var.threshold-FreeableMemory
|
||
|
alarm_description = "RDS:FreeableMemory"
|
||
|
namespace = "AWS/RDS"
|
||
|
insufficient_data_actions = []
|
||
|
actions_enabled = "true"
|
||
|
alarm_actions = [var.alarm-actions-urgent]
|
||
|
ok_actions = [var.alarm-actions-urgent]
|
||
|
dimensions = {
|
||
|
DBInstanceIdentifier = var.rds-instance-name
|
||
|
}
|
||
|
tags = var.default-tags
|
||
|
lifecycle {
|
||
|
ignore_changes = [tags]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource aws_cloudwatch_metric_alarm rds-DiskQueueDepth {
|
||
|
alarm_name = "RDS:DiskQueueDepth:${var.rds-instance-name}"
|
||
|
comparison_operator = "GreaterThanThreshold"
|
||
|
evaluation_periods = "1"
|
||
|
metric_name = "DiskQueueDepth"
|
||
|
period = "300"
|
||
|
statistic = "Average"
|
||
|
threshold = var.threshold-DiskQueueDepth
|
||
|
alarm_description = "RDS:DiskQueueDepth"
|
||
|
namespace = "AWS/RDS"
|
||
|
insufficient_data_actions = []
|
||
|
actions_enabled = "true"
|
||
|
alarm_actions = [var.alarm-actions-urgent]
|
||
|
ok_actions = [var.alarm-actions-urgent]
|
||
|
dimensions = {
|
||
|
DBInstanceIdentifier = var.rds-instance-name
|
||
|
}
|
||
|
tags = var.default-tags
|
||
|
lifecycle {
|
||
|
ignore_changes = [tags]
|
||
|
}
|
||
|
}
|