• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

docker-collectd-plugin

docker-collectd-plugin

Build Status

A Docker plugin for collectd using docker-py and collectd's Python plugin.

This uses the new stats API (moby/moby#9984) introduced by Docker 1.5.

The following container stats are reported for each container:

  • Network bandwidth
  • Memory usage
  • CPU usage
  • Block IO

The name of the container is used for the plugin_instance dimension.

Install

  1. Checkout this repository somewhere on your system accessible by collectd; for example as /usr/share/collectd/docker-collectd-plugin.
  2. Install the Python requirements with pip install -r requirements.txt.
  3. Configure the plugin (see below).
  4. Restart collectd.

Configuration

Add the following to your collectd config:

TypesDB "/usr/share/collectd/docker-collectd-plugin/dockerplugin.db"
LoadPlugin python

<Plugin python>
  ModulePath "/usr/share/collectd/docker-collectd-plugin"
  Import "dockerplugin"

  <Module dockerplugin>
    BaseURL "unix://var/run/docker.sock"
    Timeout 3
  </Module>
</Plugin>

Warning : Adding a custom TypesDB can raise a collectd error displaying :

Unhandled python exception in read callback: TypeError: Dataset gauge not found

To fix this you will have to explicitly add the path to the default types.db file. For instance, on debian-jessie, this will look like :

TypesDB "/usr/share/collectd/docker-collectd-plugin/dockerplugin.db"
TypesDB "/usr/share/collectd/types.db"

Requirements

  • docker-py
  • python-dateutil
  • docker 1.5+