From df58a0a6b68ae55e9888455d30424e86b787c802 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 1 Apr 2013 16:38:08 +0200 Subject: [PATCH] rrdcached plugin: Connect to the daemon in the read() callback. Fixes Github issue #275. Thanks to Yves Mettier for reporting this bug! --- src/rrdcached.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/rrdcached.c b/src/rrdcached.c index 11c1c6a7..3518f2dd 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -1,6 +1,6 @@ /** * collectd - src/rrdcached.c - * Copyright (C) 2008 Florian octo Forster + * Copyright (C) 2008-2013 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,7 +16,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: - * Florian octo Forster + * Florian octo Forster **/ #include "collectd.h" @@ -275,6 +275,14 @@ static int rc_read (void) sstrncpy (vl.host, daemon_address, sizeof (vl.host)); sstrncpy (vl.plugin, "rrdcached", sizeof (vl.plugin)); + status = rrdc_connect (daemon_address); + if (status != 0) + { + ERROR ("rrdcached plugin: rrdc_connect (%s) failed with status %i.", + daemon_address, status); + return (-1); + } + head = NULL; status = rrdc_stats_get (&head); if (status != 0) -- 2.11.0