X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvarnish.c;h=602f47af6231f59d40b51ccbd86800d1ca31bf3d;hb=6a5004f9c4394c8f561ba3b817196e7a50ad7237;hp=de60e39c7b21759f0fdefb062d3d74475df90fed;hpb=180f2ba844e00bd0e73acc5b4445b48652e47dcd;p=collectd.git diff --git a/src/varnish.c b/src/varnish.c index de60e39c..602f47af 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -1,8 +1,8 @@ /** * collectd - src/varnish.c - * Copyright (C) 2010 Jérôme Renard - * Copyright (C) 2010 Marc Fournier - * Copyright (C) 2010 Florian Forster + * Copyright (C) 2010 Jérôme Renard + * Copyright (C) 2010 Marc Fournier + * Copyright (C) 2010-2012 Florian 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 @@ -20,7 +20,7 @@ * Authors: * Jérôme Renard * Marc Fournier - * Florian octo Forster + * Florian octo Forster **/ /** @@ -412,11 +412,21 @@ static int varnish_read (user_data_t *ud) /* {{{ */ vd = VSM_New(); VSC_Setup(vd); - if (VSM_n_Arg(vd, conf->instance) == -1) + + if (conf->instance != NULL) { - ERROR ("Varnish plugin : unable to load statistics from instance"); - return (-1); + int status; + + status = VSM_n_Arg (vd, conf->instance); + if (status < 0) + { + ERROR ("varnish plugin: VSM_n_Arg (\"%s\") failed " + "with status %i.", + conf->instance, status); + return (-1); + } } + if (VSC_Open (vd, /* diag = */ 1)) { ERROR ("varnish plugin: Unable to load statistics.");