From: Pavel Rochnyack Date: Sun, 17 Jun 2018 09:10:54 +0000 (+0700) Subject: redis plugin: Check for / report connection errors X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=c3e2d79e837b165fceeacb4b1b8197af314b6df0;ds=sidebyside redis plugin: Check for / report connection errors --- diff --git a/src/redis.c b/src/redis.c index 68158ed2..9568fc57 100644 --- a/src/redis.c +++ b/src/redis.c @@ -423,8 +423,13 @@ static int redis_read(void) /* {{{ */ rh = redisConnectWithTimeout((char *)rn->host, rn->port, rn->timeout); if (rh == NULL) { - ERROR("redis plugin: unable to connect to node `%s' (%s:%d).", rn->name, - rn->host, rn->port); + ERROR("redis plugin: can't allocate redis context"); + continue; + } + if (rh->err) { + ERROR("redis plugin: unable to connect to node `%s' (%s:%d): %s.", + rn->name, rn->host, rn->port, rh->errstr); + redisFree(rh); continue; }