+ if(conf->collect_fetch)
+ {
+ /* Fetch head */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-head" , VSL_stats->fetch_head);
+ /* Fetch with length */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-length" , VSL_stats->fetch_length);
+ /* Fetch chunked */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-chunked" , VSL_stats->fetch_chunked);
+ /* Fetch EOF */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-eof" , VSL_stats->fetch_eof);
+ /* Fetch bad headers */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-bad_headers", VSL_stats->fetch_bad);
+ /* Fetch wanted close */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-close" , VSL_stats->fetch_close);
+ /* Fetch pre HTTP/1.1 closed */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-oldhttp" , VSL_stats->fetch_oldhttp);
+ /* Fetch zero len */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-zero" , VSL_stats->fetch_zero);
+ /* Fetch failed */
+ varnish_submit_derive (conf->instance, "http_requests", "fetch-failed" , VSL_stats->fetch_failed);
+ }
+
+ if(conf->collect_hcb)
+ {
+ /* HCB Lookups without lock */
+ varnish_submit_derive (conf->instance, "cache_operation", "lookup_nolock", VSL_stats->hcb_nolock);
+ /* HCB Lookups with lock */
+ varnish_submit_derive (conf->instance, "cache_operation", "lookup_lock", VSL_stats->hcb_lock);
+ /* HCB Inserts */
+ varnish_submit_derive (conf->instance, "cache_operation", "insert", VSL_stats->hcb_insert);
+ }
+
+ if(conf->collect_shm)
+ {
+ /* SHM records */
+ varnish_submit_derive (conf->instance, "total_operations", "shmlog-records" , VSL_stats->shm_records);
+ /* SHM writes */
+ varnish_submit_derive (conf->instance, "total_operations", "shmlog-writes" , VSL_stats->shm_writes);
+ /* SHM flushes due to overflow */
+ varnish_submit_derive (conf->instance, "total_operations", "shmlog-flushes" , VSL_stats->shm_flushes);
+ /* SHM MTX contention */
+ varnish_submit_derive (conf->instance, "total_operations", "shmlog-contention", VSL_stats->shm_cont);
+ /* SHM cycles through buffer */
+ varnish_submit_derive (conf->instance, "total_operations", "shmlog-cycles" , VSL_stats->shm_cycles);
+ }
+
+ if(conf->collect_sm)
+ {
+ /* allocator requests */
+ varnish_submit_derive (conf->instance, "total_requests", "storage-file", VSL_stats->sm_nreq);
+ /* outstanding allocations */
+ varnish_submit_gauge (conf->instance, "requests", "storage-file-outstanding", VSL_stats->sm_nobj);
+ /* bytes allocated */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-file-allocated", VSL_stats->sm_balloc);
+ /* bytes free */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-file-free", VSL_stats->sm_bfree);
+ }
+
+ if(conf->collect_sma)
+ {
+ /* SMA allocator requests */
+ varnish_submit_derive (conf->instance, "total_requests", "storage-mem", VSL_stats->sma_nreq);
+ /* SMA outstanding allocations */
+ varnish_submit_gauge (conf->instance, "requests", "storage-mem-outstanding", VSL_stats->sma_nobj);
+ /* SMA outstanding bytes */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-mem-outstanding", VSL_stats->sma_nbytes);
+ /* SMA bytes allocated */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-mem-allocated", VSL_stats->sma_balloc);
+ /* SMA bytes free */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-mem-free" , VSL_stats->sma_bfree);
+ }
+
+ if(conf->collect_sms)
+ {
+ /* SMS allocator requests */
+ varnish_submit_derive (conf->instance, "total_requests", "storage-synth", VSL_stats->sms_nreq);
+ /* SMS outstanding allocations */
+ varnish_submit_gauge (conf->instance, "requests", "storage-synth-outstanding", VSL_stats->sms_nobj);
+ /* SMS outstanding bytes */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-synth-outstanding", VSL_stats->sms_nbytes);
+ /* SMS bytes allocated */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-synth-allocated", VSL_stats->sms_balloc);
+ /* SMS bytes freed */
+ varnish_submit_gauge (conf->instance, "bytes", "storage-synth-free", VSL_stats->sms_bfree);
+ }
+} /* }}} void varnish_monitor */
+
+static int varnish_read(user_data_t *ud) /* {{{ */