From: root Date: Wed, 20 May 2015 14:38:23 +0000 (-0500) Subject: write_redis: improve checking the redis connection X-Git-Tag: collectd-5.5.0~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dee232ec86cb375f00096117475a6f21cf56e015;p=collectd.git write_redis: improve checking the redis connection --- 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); }