/collectd-docker-plugin

A collectd plugin that taps in the Docker Stats API

Primary LanguageGoMIT LicenseMIT

collectd-docker-plugin

Build Status

Collectd plugin to tap in the Docker Stats streaming API using Collectd's Exec plugin. Built with Go 1.7 and tested with Collectd 5.5 and Influx 1.0.

Installation

Example installation for a Ubuntu system. Make changes required to match your own OS.

curl -Ls "https://github.com/dustinblackman/collectd-docker-plugin/releases/download/0.2.0/collectd-docker-plugin-linux-amd64-0.2.0.tar.gz" | tar xz -C /usr/local/bin/
curl -o /usr/share/collectd https://raw.githubusercontent.com/dustinblackman/collectd-docker-plugin/master/collectd/docker.db
curl -o /etc/collectd/collectd.conf.d https://raw.githubusercontent.com/dustinblackman/collectd-docker-plugin/master/collectd/docker.conf
usermod -a -G docker nobody
service collectd restart

Parameters

Parameters are available and can be added by modifying docker.conf and appending parameters to the exec function.

  • -d, --docker-host - Docker socket path. Defaults to unix:///var/run/docker.sock
  • -de, --docker-environment - Boolean parameter to specifiy reading Docker parameters from environment variables
  • -ch, --collectd-hostname - Collectd hostname. This is automatically provided to the process from Collectd.
  • -w, --wait-time - Delay in seconds with how often metrics are submitted to Collectd. If wait time is set to 1, it will use Docker Stats API streaming, otherwise it polls. Defaults to 5.

Build From Source

Tested with Go 1.7. Versioning is done with Glide. The makefile will take care of installing it for you incase you don't have it.

git pull https://github.com/dustinblackman/collectd-docker-plugin
cd collectd-docker-plugin
make install