以下 terraform 资源创建 AWS cloudwatch 警报,但仍处于“数据不足”状态。我相信这是由于我使用的一些维度名称(DevicePath、fstype)可能不正确。我知道名称 MountPath 和 InstanceID 是正确的,但无法验证其他两个(DevicePath、fstype)。AWS 将这些维度分别称为路径、设备、fstype 和主机,但是,找不到 terraform 所称的参考。
resource "aws_cloudwatch_metric_alarm" "Low_Disk_Space_For_root_drive" {
alarm_name = "Low_Disk_Space_For_root_drive"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "disk_used_percent"
namespace = "CWAgent"
dimensions {
MountPath = "/"
DevicePath = "/dev/xvda2"
fstype = "xfs"
InstanceId = "i-xxxxxxxxxxxxxxxxx"
}
period = "60"
statistics = "Maximum"
threshold = "90"
alarm_description = "Disk usage for / is high"
insufficient_data_actions = []
actions_enabled = true
alarm_actions = ["arn:aws:sns:xxxxxx"]
ok_actions = ["arn:aws:sns:xxxxxx"]
}