From: Marc Fournier Date: Tue, 28 Oct 2014 07:32:53 +0000 (+0100) Subject: varnish: bare minimum changes to support varnish4 X-Git-Tag: collectd-5.5.0~138^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=09b9f40fc28ea15db0e1c31790fca5fa876fec4a;p=collectd.git varnish: bare minimum changes to support varnish4 --- diff --git a/src/varnish.c b/src/varnish.c index 3a8dddd7..f349bf5a 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -28,14 +28,20 @@ #include "plugin.h" #include "configfile.h" -#include +#if HAVE_VARNISH_V4 +#include +#include +typedef struct VSC_C_main c_varnish_stats_t; +#endif #if HAVE_VARNISH_V3 -# include +#include +#include typedef struct VSC_C_main c_varnish_stats_t; #endif #if HAVE_VARNISH_V2 +#include typedef struct varnish_stats c_varnish_stats_t; #endif @@ -465,7 +471,7 @@ static void varnish_monitor (const user_config_t *conf, /* {{{ */ } } /* }}} void varnish_monitor */ -#if HAVE_VARNISH_V3 +#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 static int varnish_read (user_data_t *ud) /* {{{ */ { struct VSM_data *vd; @@ -479,7 +485,9 @@ static int varnish_read (user_data_t *ud) /* {{{ */ conf = ud->data; vd = VSM_New(); +#if HAVE_VARNISH_V3 VSC_Setup(vd); +#endif if (conf->instance != NULL) { @@ -495,14 +503,22 @@ static int varnish_read (user_data_t *ud) /* {{{ */ } } +#if HAVE_VARNISH_V3 if (VSC_Open (vd, /* diag = */ 1)) +#else /* if HAVE_VARNISH_V4 */ + if (VSM_Open (vd)) +#endif { ERROR ("varnish plugin: Unable to load statistics."); return (-1); } +#if HAVE_VARNISH_V3 stats = VSC_Main(vd); +#else /* if HAVE_VARNISH_V4 */ + stats = VSC_Main(vd, NULL); +#endif varnish_monitor (conf, stats); VSM_Close (vd);