From ea1b4ec1b811e50fc3214452b5198258fffafab8 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 12 Jun 2010 12:20:38 +0200 Subject: [PATCH] Varnish plugin: Use "varnish_config_apply_default" to initialize the structure. --- src/varnish.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/varnish.c b/src/varnish.c index 33c57ec9..dc921116 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -390,10 +390,17 @@ static int varnish_config_apply_default (user_config_t *conf) /* {{{ */ if (conf == NULL) return (EINVAL); - conf->collect_cache = 1; - conf->collect_backend = 1; + conf->collect_backend = 1; + conf->collect_cache = 1; conf->collect_connections = 1; - conf->collect_shm = 1; + conf->collect_esi = 0; + conf->collect_fetch = 0; + conf->collect_hcb = 0; + conf->collect_shm = 1; + conf->collect_sm = 0; + conf->collect_sma = 0; + conf->collect_sms = 0; + conf->collect_totals = 0; return (0); } /* }}} int varnish_config_apply_default */ @@ -441,6 +448,8 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */ memset (conf, 0, sizeof (*conf)); conf->instance = NULL; + varnish_config_apply_default (conf); + if (ci->values_num == 1) { int status; @@ -512,7 +521,10 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */ && !conf->collect_sm && !conf->collect_totals) { - varnish_config_apply_default (conf); + WARNING ("Varnish plugin: No metric has been configured for " + "instance \"%s\". Disabling this instance.", + (conf->instance == NULL) ? "localhost" : conf->instance); + return (EINVAL); } ssnprintf (callback_name, sizeof (callback_name), "varnish/%s", -- 2.30.2