137 lines
5.0 KiB
HCL
137 lines
5.0 KiB
HCL
resource "aws_cloudwatch_metric_alarm" "rds-cpu" {
|
|
alarm_name = "${var.cw-alarm-prefix}: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 = var.actions-enabled
|
|
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 = "${var.cw-alarm-prefix}: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 = var.actions-enabled
|
|
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 = "${var.cw-alarm-prefix}: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 = var.actions-enabled
|
|
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 = "${var.cw-alarm-prefix}:RDS:DiskQueueDepth:${var.rds-instance-name}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = "DiskQueueDepth"
|
|
period = "300"
|
|
statistic = "Average"
|
|
threshold = var.threshold-DiskQueueDepth
|
|
alarm_description = "RDS:DiskQueueDepth"
|
|
namespace = "AWS/RDS"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
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-ReadLatency" {
|
|
alarm_name = "${var.cw-alarm-prefix}:RDS:ReadLatency:${var.rds-instance-name}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = "ReadLatency"
|
|
period = "900"
|
|
statistic = "Average"
|
|
threshold = var.threshold-ReadLatency
|
|
alarm_description = "RDS:ReadLatency"
|
|
namespace = "AWS/RDS"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
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-WriteLatency" {
|
|
alarm_name = "${var.cw-alarm-prefix}:RDS:WriteLatency:${var.rds-instance-name}"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = "2"
|
|
metric_name = "WriteLatency"
|
|
period = "900"
|
|
statistic = "Average"
|
|
threshold = var.threshold-WriteLatency
|
|
alarm_description = "RDS:WriteLatency"
|
|
namespace = "AWS/RDS"
|
|
insufficient_data_actions = []
|
|
actions_enabled = var.actions-enabled
|
|
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]
|
|
}
|
|
} |