+ vd = VSM_New();
+ VSC_Setup(vd);
+ if (VSM_n_Arg(vd, conf->instance) == -1)
+ {
+ ERROR ("Varnish plugin : unable to load statistics from instance");
+ return (-1);
+ }
+ if (VSC_Open (vd, /* diag = */ 1))
+ {
+ ERROR ("varnish plugin: Unable to load statistics.");
+
+ return (-1);
+ }
+
+ stats = VSC_Main(vd);
+
+ varnish_monitor (conf, stats);
+ VSM_Close (vd);
+
+ return (0);
+} /* }}} */
+#else /* if HAVE_VARNISH_V2 */
+static int varnish_read (user_data_t *ud) /* {{{ */
+{
+ const c_varnish_stats_t *stats;
+
+ user_config_t *conf;
+
+ if ((ud == NULL) || (ud->data == NULL))
+ return (EINVAL);
+
+ conf = ud->data;
+
+ stats = VSL_OpenStats (conf->instance);
+ if (stats == NULL)