* n_smf_frag N small free smf N
* n_smf_large N large free smf N
* n_vbe_conn N struct vbe_conn N
- * n_wrk N worker threads N
- * n_wrk_create N worker threads created N
- * n_wrk_failed N worker threads not created N
- * n_wrk_max N worker threads limited N
- * n_wrk_queue N queued work requests N
- * n_wrk_overflow N overflowed work requests N
- * n_wrk_drop N dropped work requests N
+ * n_wrk N worker threads Y
+ * n_wrk_create N worker threads created Y
+ * n_wrk_failed N worker threads not created Y
+ * n_wrk_max N worker threads limited Y
+ * n_wrk_queue N queued work requests Y
+ * n_wrk_overflow N overflowed work requests Y
+ * n_wrk_drop N dropped work requests Y
* n_backend N backends N
* n_expired N expired objects N
* n_lru_nuked N LRU nuked objects N
* n_objsendfile Objects sent with sendfile N
* n_objwrite Objects sent with write N
* n_objoverflow Objects overflowing workspace N
- * s_sess Total Sessions N
- * s_req Total Requests N
- * s_pipe Total pipe N
- * s_pass Total pass N
- * s_fetch Total fetch N
- * s_hdrbytes Total header bytes N
- * s_bodybytes Total body bytes N
+ * s_sess Total Sessions Y
+ * s_req Total Requests Y
+ * s_pipe Total pipe Y
+ * s_pass Total pass Y
+ * s_fetch Total fetch Y
+ * s_hdrbytes Total header bytes Y
+ * s_bodybytes Total body bytes Y
* sess_closed Session Closed N
* sess_pipeline Session Pipeline N
* sess_readahead Session Read Ahead N
_Bool collect_sma;
_Bool collect_sms;
_Bool collect_sm;
+ _Bool collect_totals;
+ _Bool collect_workers;
};
typedef struct user_config_s user_config_t; /* }}} */
/* SMS bytes freed */
varnish_submit_gauge (conf->instance, "bytes", "storage-synth-free", VSL_stats->sms_bfree);
}
+
+ if(conf->collect_totals)
+ {
+ /* Total Sessions */
+ varnish_submit_derive (conf->instance, "total_sessions", "sessions", VSL_stats->s_sess);
+ /* Total Requests */
+ varnish_submit_derive (conf->instance, "total_requests", "requests", VSL_stats->s_req);
+ /* Total pipe */
+ varnish_submit_derive (conf->instance, "total_operations", "pipe", VSL_stats->s_pipe);
+ /* Total pass */
+ varnish_submit_derive (conf->instance, "total_operations", "pass", VSL_stats->s_pass);
+ /* Total fetch */
+ varnish_submit_derive (conf->instance, "total_operations", "fetches", VSL_stats->s_fetch);
+ /* Total header bytes */
+ varnish_submit_derive (conf->instance, "total_bytes", "header-bytes", VSL_stats->s_hdrbytes);
+ /* Total body byte */
+ varnish_submit_derive (conf->instance, "total_bytes", "body-bytes", VSL_stats->s_bodybytes);
+ }
+
+ if(conf->collect_workers)
+ {
+ /* worker threads */
+ varnish_submit_gauge (conf->instance, "threads", "worker", VSL_stats->n_wrk);
+ /* worker threads created */
+ varnish_submit_gauge (conf->instance, "total_threads", "threads-created", VSL_stats->n_wrk_create);
+ /* worker threads not created */
+ varnish_submit_gauge (conf->instance, "total_threads", "threads-failed", VSL_stats->n_wrk_failed);
+ /* worker threads limited */
+ varnish_submit_gauge (conf->instance, "total_threads", "threads-limited", VSL_stats->n_wrk_max);
+ /* queued work requests */
+ varnish_submit_gauge (conf->instance, "total_requests", "worker-queued", VSL_stats->n_wrk_queue);
+ /* overflowed work requests */
+ varnish_submit_gauge (conf->instance, "total_requests", "worker-overflowed", VSL_stats->n_wrk_overflow);
+ /* dropped work requests */
+ varnish_submit_gauge (conf->instance, "total_requests", "worker-dropped", VSL_stats->n_wrk_drop);
+ }
} /* }}} void varnish_monitor */
static int varnish_read(user_data_t *ud) /* {{{ */
sfree (conf);
} /* }}} */
+static int varnish_config_apply_default (user_config_t *conf) /* {{{ */
+{
+ if (conf == NULL)
+ return (EINVAL);
+
+ conf->collect_backend = 1;
+ conf->collect_cache = 1;
+ conf->collect_connections = 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 */
+
static int varnish_init (void) /* {{{ */
{
user_config_t *conf;
/* Default settings: */
conf->instance = NULL;
- conf->collect_cache = 1;
- conf->collect_backend = 1;
- conf->collect_connections = 1;
- conf->collect_shm = 1;
+
+ varnish_config_apply_default (conf);
ud.data = conf;
ud.free_func = varnish_config_free;
memset (conf, 0, sizeof (*conf));
conf->instance = NULL;
+ varnish_config_apply_default (conf);
+
if (ci->values_num == 1)
{
int status;
cf_util_get_boolean (child, &conf->collect_sms);
else if (strcasecmp ("CollectSM", child->key) == 0)
cf_util_get_boolean (child, &conf->collect_sm);
+ else if (strcasecmp ("CollectTotals", child->key) == 0)
+ cf_util_get_boolean (child, &conf->collect_totals);
+ else if (strcasecmp ("CollectWorkers", child->key) == 0)
+ cf_util_get_boolean (child, &conf->collect_workers);
else
{
WARNING ("Varnish plugin: Ignoring unknown "
&& !conf->collect_shm
&& !conf->collect_sma
&& !conf->collect_sms
- && !conf->collect_sm)
+ && !conf->collect_sm
+ && !conf->collect_totals
+ && !conf->collect_workers)
{
WARNING ("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",