如何在邮件通知中包含健康检查失败的目标的详细信息?(Lambda,SNS)

0

【以下的问题经过翻译处理】 后端API应用程序可以运行在EC2实例、类似Elastic Beanstalk的PaaS或甚至ECS这样的容器运行时平台上。如您已经知道的,我们使用应用程序的健康检查端点配置目标组,并允许负载均衡器使用某些阈值参数确定健康状态。我们能够定期运行健康检查,并且仅在检查不通过时发送电子邮件。现在,我该怎么样在邮件中包含健康检查失败的目标的详细信息?并且有没有一种仅通过控制台完成的方法?

1 Answer
0

【以下的回答经过翻译处理】 设置CloudWatch警报,当健康检查超过阈值时进行警报。

通过警报触发,Lambda执行“describe_target_health”以检索“不健康”状态的内容。

将该信息从Lambda发送到SNS以进行电子邮件通知如何?

参考文献:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elbv2/client/describe_target_health.html

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sns/client/publish.html

profile picture
EXPERT
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions