lighthouse.checks.tcp

class lighthouse.checks.tcp.TCPCheck(*args, **kwargs)[source]

Bases: lighthouse.check.Check

Service health check using TCP request/response messages.

Sends a certain message to the configured port and passes if the response is an expected one.

name = 'tcp'
classmethod validate_dependencies()[source]

This check uses stdlib modules so dependencies are always present.

classmethod validate_check_config(config)[source]

Ensures that a query and expected response are configured.

apply_check_config(config)[source]

Takes the query and response fields from a validated config dictionary and sets the proper instance attributes.

perform()[source]

Performs a straightforward TCP request and response.

Sends the TCP query to the proper host and port, and loops over the socket, gathering response chunks until a full line is acquired.

If the response line matches the expected value, the check passes. If not, the check fails. The check will also fail if there’s an error during any step of the send/receive process.