假设我有这个警报:
resource "aws_cloudwatch_metric_alarm" "nlb_healthyhosts" {
alarm_name = "alarmname"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
metric_name = "HealthyHostCount"
namespace = "AWS/NetworkELB"
period = "60"
statistic = "Average"
threshold = var.logstash_servers_count
alarm_description = "Number of healthy nodes in Target Group"
actions_enabled = "true"
alarm_actions = [aws_sns_topic.sns.arn]
ok_actions = [aws_sns_topic.sns.arn]
dimensions = {
TargetGroup = aws_lb_target_group.lb-tg.arn_suffix
LoadBalancer = aws_lb.lb.arn_suffix
}
}
在维度下,我在 AWS 文档中看到只有几个可用的 EC2 实例维度是(例如实例 ID - 等....)。在我的项目中,我使用一个名为“Type”的标签将我的实例分类为 HTTP 或 APP 实例。有没有办法根据这些标签作为维度创建警报?意思是为带有标签“Http”的实例创建警报,并为标记为“App”的实例创建警报。非常感谢你。 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html#ec2-cloudwatch-dimensions