summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 70d4799)
raw | patch | inline | side by side (parent: 70d4799)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 28 Oct 2014 17:35:55 +0000 (18:35 +0100) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 28 Oct 2014 18:21:53 +0000 (19:21 +0100) |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/varnish.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 80e1d5cd4aefbf83c8afd302d3fa3e3d0c1608f4..0583c00633b8541e5a153f18f94f66d6531cefd4 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# CollectUptime false
# CollectVCL false
# CollectWorkers false
+# CollectVSM false # Varnish 4 only
# </Instance>
#</Plugin>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index ac0ff2abb0bf2394e886dba70244760c61fb66a8..1ba85006480cb4d6dd8225713045332af5d1b021 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
CollectSM false
CollectTotals false
CollectWorkers false
+ CollectVSM false
</Instance>
</Plugin>
@@ -6431,6 +6432,11 @@ Number of total (available + discarded) VCL (config files). False by default.
Collect statistics about worker threads. False by default.
+=item B<CollectVSM> B<true>|B<false>
+
+Collect statistics about Varnish's shared memory usage (used by the logging and
+statisticss subsystems). False by default.
+
=back
=head2 Plugin C<virt>
diff --git a/src/varnish.c b/src/varnish.c
index 517258e2cf3148bd1276c3d51811a67b75a191a3..38efcdc8929e19d2d7912a120dc613537123f2fa 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
#endif
_Bool collect_vcl;
_Bool collect_workers;
+#if HAVE_VARNISH_V4
+ _Bool collect_vsm;
+#endif
};
typedef struct user_config_s user_config_t; /* }}} */
#endif
#endif
}
+
+#if HAVE_VARNISH_V4
+ if (conf->collect_vsm)
+ {
+ /* Free VSM space */
+ varnish_submit_gauge (conf->instance, "vsm", "bytes", "free", stats->vsm_free);
+ /* Used VSM space */
+ varnish_submit_gauge (conf->instance, "vsm", "bytes", "used", stats->vsm_used);
+ /* Cooling VSM space */
+ varnish_submit_gauge (conf->instance, "vsm", "bytes", "cooling", stats->vsm_cooling);
+ /* Overflow VSM space */
+ varnish_submit_gauge (conf->instance, "vsm", "bytes", "overflow", stats->vsm_overflow);
+ /* Total overflowed VSM space */
+ varnish_submit_derive (conf->instance, "vsm", "total_bytes", "overflowed", stats->vsm_overflowed);
+ }
+#endif
+
} /* }}} void varnish_monitor */
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
#endif
conf->collect_vcl = 0;
conf->collect_workers = 0;
+#if HAVE_VARNISH_V4
+ conf->collect_vsm = 0;
+#endif
return (0);
} /* }}} int varnish_config_apply_default */
cf_util_get_boolean (child, &conf->collect_vcl);
else if (strcasecmp ("CollectWorkers", child->key) == 0)
cf_util_get_boolean (child, &conf->collect_workers);
+#if HAVE_VARNISH_V4
+ else if (strcasecmp ("CollectVSM", child->key) == 0)
+ cf_util_get_boolean (child, &conf->collect_vsm);
+#endif
else
{
WARNING ("Varnish plugin: Ignoring unknown "
&& !conf->collect_uptime
#endif
&& !conf->collect_vcl
- && !conf->collect_workers)
+ && !conf->collect_workers
+#if HAVE_VARNISH_V4
+ && !conf->collect_vsm
+#endif
+ )
{
WARNING ("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",