737
738
return sequential_check(subchecks)
740
def make_redis_check(host, port, **kwargs):
741
def make_redis_check(host, port, password=None, **kwargs):
741
742
"""Make a check for the configured redis server."""
744
745
subchecks.append(make_tcp_check(host, port))
747
"""Connect and authenticate."""
748
client = redis.client.Redis(host=host, port=port)
749
if not client.ping():
750
raise RuntimeError("failed to ping redis")
752
subchecks.append(make_check("auth", do_auth))
749
"""Connect and authenticate.
751
client_creator = ClientCreator(reactor, txredis.client.RedisClient)
752
client = yield client_creator.connectTCP(host=host, port=port,
753
timeout=CONNECT_TIMEOUT)
756
ping = yield client.ping()
758
raise RuntimeError("failed to ping redis")
760
resp = yield client.auth(password)
762
raise RuntimeError("failed to auth to redis")
764
connect_info = "connect with auth" if password is not None else "connect"
765
subchecks.append(make_check(connect_info, do_connect))
753
766
return add_check_prefix('redis', sequential_check(subchecks))