From: Florian Forster Date: Sat, 12 Jun 2010 10:20:38 +0000 (+0200) Subject: Varnish plugin: Use "varnish_config_apply_default" to initialize the structure. X-Git-Tag: collectd-5.0.0-beta0~103^2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ea1b4ec1b811e50fc3214452b5198258fffafab8;p=collectd.git Varnish plugin: Use "varnish_config_apply_default" to initialize the structure. --- 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",