Public | Automated Build

Last pushed: 2 years ago
Short Description
Collectd running on vrtsystems/baseimage with supervisord entrypoint
Full Description

VRT Systems Docker Collectd

Docker image to run Collectd in a container, with a supervisord entrypoint.

How to Use this Image

To create the image vrtsystems/collectd, execute the following command in the docker-collectd folder:

docker build -t vrtsystems/collectd .

Running your CollectD image

This image includes a minimalist configuration, but looks for scripts supplied
in /usr/local/etc/docker-collectd/plugins-init.d to configure the plugins.
While it is expected that this would normally be achieved by basing other
images on this one, you could just as easily achieve a similar outcome by
mapping a volume containing scripts.

docker run -d -v /my_config_scripts:/usr/local/etc/docker-collectd/plugins-init.d vrtsystems/collectd

Note that many of the collectd plugins use /proc to gather statistics, and
docker provides containers with a limited view of /proc, which can skew
statistics. If you're wanting to monitor host statistics from within this
container, then you can map the host's /proc to /mnt/proc and it will use
that (with a bind mount). If you do this, you'll also want to use the
--privileged option at runtime:

docker run -d --privileged -v /proc:/mnt/proc vrtsystems/collectd

Although you may be able to achieve all the configuration you require purely
through the runtime methods described here, more comprehensive customisation
will likely require this image to be extended, and it has been designed
explicitly for this purpose - see [How to extend this image] below.

Environment Variables

Configuration of collectd's Global and Logging sections (basically all the
stuff that comes before plugin loading) can be overridden at runtime via
environment variables. These are of the form CD_[section]_[setting] where
section is null for the global settings, and PLUGIN_LOGFILE for the logfile
plugin settings. For example, common global and log variables:


Note that where collectd is particular about quotes and you need to surround a
value with quotes, you'll need to pass those in explicitly (note the extra '
below). In a Dockerfile:

ENV CD__HOSTNAME '"myhostname"'

...or on the command line:

docker run -e 'CD__HOSTNAME="myhostname"'

How to extend this image

You can extend the image with a Dockerfile to add features or customise its
behaviour for a specific application.

With plugins

This image ships with a limited set of plugins and may not include all plugin
dependencies, but it's designed to be easily extended. It uses a debian-style
"init.d" loader which looks in /usr/local/etc/docker-collectd/plugins-init.d
for executable (script) files. To add a plugin to a Docker image built from
this image, you need to add a file to this directory which produces config
file output to configure the plugin. The output from each of these scripts is
appended in turn (they are loaded in alphabetical order so you can control the
sequence with numbered prefixes) to the collectd.conf file. The use of shell
scripts allows you to embed configuration literally (e.g. as a "here doc"), to
expand environment variables (just embed the variable references in your
script), and to implement more sophiticated conditional logic to handle more
sophisticated requirements.

In cases where the plugin or its dependencies aren't in the base image, you
can add these through the Debian packaging system. To get collectd to load the
plugin, either use the AutoLoadPlugin setting (ENV CD__AUTOLOADPLUGIN true)
or put a LoadPlugin directive at the start of each .conf file.

Docker Pull Command
Source Repository