StatsD embedded into CollectD

embedded StatsD in CollectD
Since v5.4, CollectD implements the StatsD network protocol.
You might not need to run two separate processes anymore.

About StatsD in CollectD

StatsD and CollectD are complementary monitoring solution.

  • Stats is an event counter/aggregation service. Simply send events to this external service to monitor your own code. Periodically the aggregated events are sent to a database.
  • CollectD is a statistics collection daemon. It periodically polls various sources such as your OS CPU, RAM, network but also from many database and software.

StatsD is also “embedded” into CollectD since v5.4 with the StatsD plugin. CollectD can now act as a StatsD process.

Install StatsD plugin for CollectD

Edit CollectD configuration file; usually located at /opt/collectd/etc/collectd.conf

Uncomment or add StatsD plugin and configuration:

Don’t forget to restart CollectD:

  • Host “”; listen to any IP. Change to “” to only allow localhost to send metrics.
  • port 8125; where StatsD metrics will be received.
  • DeleteSets true;  the values of type sets metrics will not be sent if they didn’t change since the last interval.

Read more about StatsD plugin configuration

Calling CollectD StatsD

Many StatsD client libraries exist in various programming language. Pick your favorite and call StatsD on port 8125.
It’s also possible to call the Plugin from the command line:

If like me, your CollectD sends it metrics to InfluxDB you should see the values in your database.

Calling both commands:

  • within the interval will result in an aggregate value of 5
  • out of the interval will result in two values 4 and 1

influxdb statsd aggregated


StatsD is a very clever idea but not a complex software. It behaviour was replicated in 730 lines of C.

This Plugin is stable and was able to achieve 50k events per second on commodity hardware. If you already run CollectD and don’t need to run StatsD at scale it is highly recommend using this plugin. Save yourself the pain of running both services.

Monitor & detect anomalies with