From dee232ec86cb375f00096117475a6f21cf56e015 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 May 2015 09:38:23 -0500 Subject: [PATCH] write_redis: improve checking the redis connection --- src/write_redis.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/write_redis.c b/src/write_redis.c index 40f9074b..1e7281cb 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -111,11 +111,12 @@ static int wr_write (const data_set_t *ds, /* {{{ */ if (node->conn == NULL) { node->conn = redisConnectWithTimeout ((char *)node->host, node->port, node->timeout); - if (node->conn == NULL) + if (node->conn != NULL && node->conn->err) { - ERROR ("write_redis plugin: Connecting to host \"%s\" (port %i) failed.", + ERROR ("write_redis plugin: Connecting to host \"%s\" (port %i) failed: %s", (node->host != NULL) ? node->host : "localhost", - (node->port != 0) ? node->port : 6379); + (node->port != 0) ? node->port : 6379, + node->conn->errstr); pthread_mutex_unlock (&node->lock); return (-1); } -- 2.30.2