consul.check module¶
- class consul.check.Check[source]¶
Bases:
objectThere are three different kinds of checks: script, http and ttl
- classmethod script(args, interval, deregister=None)[source]¶
Run the script args every interval (e.g. “10s”) to peform health check
- classmethod http(url, interval, timeout=None, deregister=None, header=None)[source]¶
Peform a HTTP GET against url every interval (e.g. “10s”) to peform health check with an optional timeout and optional deregister after which a failing service will be automatically deregistered. Optional parameter header specifies headers sent in HTTP request. header paramater is in form of map of lists of strings, e.g. {“x-foo”: [“bar”, “baz”]}.
- classmethod tcp(host, port, interval, timeout=None, deregister=None)[source]¶
Attempt to establish a tcp connection to the specified host and port at a specified interval with optional timeout and optional deregister after which a failing service will be automatically deregistered.
- classmethod ttl(ttl)[source]¶
Set check to be marked as critical after ttl (e.g. “10s”) unless the check is periodically marked as passing.
- classmethod docker(container_id, shell, script, interval, deregister=None)[source]¶
Invoke script packaged within a running docker container with container_id at a specified interval on the configured shell using the Docker Exec API. Optional register after which a failing service will be automatically deregistered.