summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc4025b)
raw | patch | inline | side by side (parent: cc4025b)
author | Florian Forster <octo@collectd.org> | |
Mon, 17 Jun 2013 11:54:09 +0000 (13:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 17 Jun 2013 11:54:09 +0000 (13:54 +0200) |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/statsd.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 7717bc345f917eb9241ec5acda62bebe99cb02e5..8b616946aadcdd64024fea2d57347c8446b9c452 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# </Host>
#</Plugin>
+#<Plugin statsd>
+# Host "::"
+# Port "8125"
+#</Plugin>
+
#<Plugin "swap">
# ReportByDevice false
# ReportBytes true
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 541af4ce9340b66450a06a21a5d582e3c9331c63..c98b5f10a394adb8f43785e52e3e1ae3a09861e9 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -5103,6 +5103,28 @@ Since the configuration of the C<snmp plugin> is a little more complicated than
other plugins, its documentation has been moved to an own manpage,
L<collectd-snmp(5)>. Please see there for details.
+=head2 Plugin C<statsd>
+
+The I<statsd plugin> listens to a UDP socket, reads "events" in the statsd
+protocol and dispatches rates or other aggregates of these numbers
+periodically.
+
+The following configuration options are valid:
+
+=over 4
+
+=item B<Host> I<Host>
+
+Bind to the hostname / address I<Host>. By default, the plugin will bind to the
+"any" address, i.e. accept packets sent to any of the hosts addresses.
+
+=item B<Port> I<Port>
+
+UDP port to listen to. This can be either a service name or a port number.
+Defaults to C<8125>.
+
+=back
+
=head2 Plugin C<swap>
The I<Swap plugin> collects information about used and available swap space. On
diff --git a/src/statsd.c b/src/statsd.c
index 896fb619ffcdcc90095b042595ea8aa53e7477b0..5fac8d47bfffe3a3d7bb9b8c5b3c5589f02f5b15 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
return ((void *) 0);
} /* }}} void *statsd_network_thread */
+static int statsd_config (oconfig_item_t *ci) /* {{{ */
+{
+ int i;
+
+ for (i = 0; i < ci->children_num; i++)
+ {
+ oconfig_item_t *child = ci->children + i;
+
+ if (strcasecmp ("Host", child->key) == 0)
+ cf_util_get_string (child, &conf_node);
+ else if (strcasecmp ("Port", child->key) == 0)
+ cf_util_get_service (child, &conf_service);
+ /* TODO: Add configuration for Delete{Counters,Timers,Gauges} */
+ else
+ ERROR ("statsd plugin: The \"%s\" config option is not valid.",
+ child->key);
+ }
+
+ return (0);
+} /* }}} int statsd_config */
+
static int statsd_init (void) /* {{{ */
{
pthread_mutex_lock (&metrics_lock);
}
i = c_avl_get_iterator (metrics_tree);
+ /* TODO: Delete legacy metrics */
while (c_avl_iterator_next (i, (void *) &name, (void *) &metric) == 0)
statsd_metric_submit (name, metric);
c_avl_iterator_destroy (i);
c_avl_destroy (metrics_tree);
metrics_tree = NULL;
+ sfree (conf_node);
+ sfree (conf_service);
+
pthread_mutex_unlock (&metrics_lock);
return (0);
void module_register (void)
{
+ plugin_register_complex_config ("statsd", statsd_config);
plugin_register_init ("statsd", statsd_init);
plugin_register_read ("statsd", statsd_read);
plugin_register_shutdown ("statsd", statsd_shutdown);