python boto - 如何为路径53创建运行状况检查

时间:2014-05-21 04:42:56

标签: python boto amazon-route53

如何使用python boto为route53创建运行状况检查?没有示例和文档非常缺乏http://boto.readthedocs.org/en/latest/ref/route53.html

所以如果给出了ip地址,端口和路径.....那么呢?

1 个答案:

答案 0 :(得分:1)

即使缺少boto文档,您也可以the codeAWS API来理解它。

查看boto.route53.healthcheck.HealthCheck并执行

route = boto.connect_route53()
hc = boto.route53.healthcheck.HealthCheck(...)
route = create_health_check(hc)

...将由the help page HealthCheck填写:

Help on HealthCheck in module boto.route53.healthcheck object:

class HealthCheck(__builtin__.object)
 |  An individual health check
 |  
 |  Methods defined here:
 |  
 |  __init__(self, ip_addr, port, hc_type, resource_path, fqdn=None, string_match=None, request_interval=30, failure_threshold=3)
 |      HealthCheck object
 |      
 |      :type ip_addr: str
 |      :param ip_addr: IP Address
 |      
 |      :type port: int
 |      :param port: Port to check
 |      
 |      :type hc_type: str
 |      :param ip_addr: One of HTTP | HTTPS | HTTP_STR_MATCH | HTTPS_STR_MATCH | TCP
 |      
 |      :type resource_path: str
 |      :param resource_path: Path to check
 |      
 |      :type fqdn: str
 |      :param fqdn: domain name of the endpoint to check
 |      
 |      :type string_match: str
 |      :param string_match: if hc_type is HTTP_STR_MATCH or HTTPS_STR_MATCH, the string to search for in the response body from the specified resource
 |      
 |      :type request_interval: int
 |      :param request_interval: The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request.
 |      
 |      :type failure_threshold: int
 |      :param failure_threshold: The number of consecutive health checks that an endpoint must pass or fail for Amazon Route 53 to change the current status of the endpoint from unhealthy to healthy or vice versa.
 |  
 |  to_xml(self)
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  POSTXMLBody = '\n        <HealthCheckConfig>\n            <IPAddr...il...
 |  
 |  XMLFQDNPart = '<FullyQualifiedDomainName>%(fqdn)s</FullyQualifiedDomai...
 |  
 |  XMLRequestIntervalPart = '<RequestInterval>%(request_interval)d</Reque...
 |  
 |  XMLStringMatchPart = '<SearchString>%(string_match)s</SearchString>'
 |  
 |  valid_request_intervals = (10, 30)