【问题标题】:Identifying AWS unhealthy hosts in target group识别目标组中的 AWS 不健康主机
【发布时间】:2018-09-13 21:35:52
【问题描述】:

我有多个目标组在 AWS ALB 后面运行。此外,我设置了 cloudwatch 警报来监控这些目标群体的健康状况。每当该组中的目标生成不健康主机警报时,AWS 都会发送一封电子邮件,提醒我该组中的目标不健康。但是,警报和电子邮件并未通知我此目标组中的哪个实例不健康。

有没有办法或解决方案来实施并找出该组中的哪个目标是导致问题的目标?

【问题讨论】:

标签: amazon-web-services amazon-ec2


【解决方案1】:
# Trigger the lambda function when an EC2 instance is terminated
resource "aws_cloudwatch_event_rule" "instance_terminated" {
  name = "ChefCleanup-InstanceTerminated-rule"
  description = "Capture each EC2 instance termination"
  event_pattern = <<PATTERN
  {
    "source": [ "aws.ec2" ],
    "detail-type": [ "EC2 Instance State-change Notification" ],
    "detail": {
      "state": [ "terminated" ]
    }
  }
PATTERN
}

# Set event target to call the lambda
resource "aws_cloudwatch_event_target" "instance_terminated" {
  rule      = "${aws_cloudwatch_event_rule.instance_terminated.name}"
  target_id = "chef-cleanup-lambda"
  arn      = "${aws_lambda_function.chef_cleanup.arn}"
}

【讨论】:

    猜你喜欢
    • 2018-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-29
    • 1970-01-01
    • 2022-01-06
    • 2021-06-30
    相关资源
    最近更新 更多