From: Pavel Rochnyack Date: Sun, 17 Jun 2018 09:10:54 +0000 (+0700) Subject: redis plugin: Check for / report connection errors X-Git-Tag: collectd-5.9.0~178^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3e2d79e837b165fceeacb4b1b8197af314b6df0;p=thirdparty%2Fcollectd.git redis plugin: Check for / report connection errors --- diff --git a/src/redis.c b/src/redis.c index 68158ed20..9568fc57c 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; }