简体   繁体   English

Ruby AWS-SDK:如何列出健康检查的父检查

[英]Ruby AWS-SDK: How to list the parent checks of a health check

I have a job that cleans out unused health checks. 我的工作是清理未使用的健康检查。 Some of them cant be deleted if they have a parent check resulting in the error: 如果其中一些经过父检查导致错误,则无法将其删除:

Invalid parameter : Health check SOMEHEALTHCHECKID is still referenced from parent health check(s): SOMEHEALTHCHECKID-PARENT

How can I list the parents of a health check? 如何列出健康检查的父母? I would like to be able to obtain the id of the parent check in a method that is more stable than parsing the error message string. 我希望能够以比解析错误消息字符串更稳定的方法获取父检查的ID。

My solution was to collect all the health checks in route53 and parse them for any that matched the CALCULATED config type: 我的解决方案是收集route53中的所有运行状况检查,并分析它们是否符合CALCULATED配置类型:

check[:health_check_config][:type] == "CALCULATED"

Then after getting the Aws::Route53::Errors::InvalidInput error during health check deletion, I would search through my parent check collection to see if any parent check included the failed check in its child_health_checks array: 然后在删除运行状况检查期间Aws::Route53::Errors::InvalidInput错误之后,我将搜索我的父检查集合,以查看是否有任何父检查在其child_health_checks数组中包括失败的检查:

parent_checks = parents.select{|parent_check| 
  parent_check[:health_check_config][:child_health_checks].include?(check[:id])
}

I could then delete all the matching parent checks and retry the regular deletion after. 然后,我可以删除所有匹配的父检查,然后重试常规删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM