Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


collectd-lib (4) Versions 3.0.1

Install and configure the collectd monitoring daemon

cookbook 'collectd-lib', '= 3.0.1', :supermarket
cookbook 'collectd-lib', '= 3.0.1'
knife supermarket install collectd-lib
knife supermarket download collectd-lib
Quality 100%


Library cookbook for the collectd monitoring daemon.
This cookbook introduce accumulator pattern for managing plugins.
I have to rename it from collectd to collectd-lib because I want to publish it to supermarket. And it conflicts with existing one.


By default cookbook does nothing. You have to wrap it in your projects' cookbook. See example in test/fixtures folder.



The collectd_conf defines configuration for collectd. The config is represented as a Hash and its syntax may be complecated.
This resource is very smart.


Cookbook generates node['collectd']['conf_dir']/collectd.conf file. It consists of four main parts:

  1. Base Configuration. Manage it via node attributes
  2. Dynamic Section for all plugins (tuples, sorted by priority and name)
  3. Dynamic Section for all generic configurations (tuples, sorted by priority)
  4. Include directive for extra config files. By default from /etc/collectd/collectd.conf.d/*.conf

Dynamic sections consists of tuples. Each collectd_conf defines a tuple. It uses conf attributes as a Hash for config source.

The conf hash is converted to collectd-style settings automatically. Here is the rules for conf:

If key is a String and value is a String it produces Key "value":

collectd_conf 'string-string' do
  conf 'Key' => 'Value', 'Key2' => 'Value2'


Key "value"
Key2 "value2"

If key is a String and value is a Fixnum it produces Key value:

collectd_conf 'string-fixnum' do
  conf 'TheAnswerIs' => 42


TheAnswerIs 42

If key is a String and value is a Array it produces lines Key value for each value.

collectd_conf 'string-array' do
  conf 'MultipleLines' => [1, "string", ["ar", "ray"]],
       'MultipleValues' => [ [1, 2, false] ]


MultipleLines 1
MultipleLines "string"
MultipleLines "ar" "ray"
MultipleValues 1 2 false

If key is a String and value is a Hash it produces section.

collectd_conf 'string-hash' do
  conf 'Section' => {
    'Key' => 'value',
    'SubSection' => {
      'SubKey' => 'SubValue'


Key "value" SubKey "SubValue"

If key is a Array and value is a Hash it produces section with key[0] name and attribute key[1].

collectd_conf 'array-hash' do
  conf %w(Include /etc/collectd/collectd.conf.d) => {
    'Filter' => '*.conf'


  Filter "*.conf"

One more:

collectd_conf 'curl' do
  plugin 'curl'
  conf %w(Page stock_quotes) => {
    'URL' => '',
    'User' => 'foo',
    'Password' => 'bar',
    'Match' => { 'Regexp' => 'blabla.*', 'DsType' => 'GaugeAverage' }


LoadPlugin "curl"

    URL ""
    User "foo"
    Password "bar"
        Regexp "blabla.*"
        DsType "GaugeAverage"

Here is the rules for plugin attribute:

If it is value is a String and conf is nil it produces LoadPlugin "value"

collectd_conf 'plugin-string' do
  plugin 'cpu'


LoadPlugin "cpu"

If it is value is a String and conf not nil it produces LoadPlugin "value" and plugin section. conf goes into plugin section

collectd_conf 'plugin-string-conf' do
  plugin 'disk'
  conf 'Disk' => %w(sda sdb sdc sdd)


LoadPlugin "disk"

  Disk "sda"
  Disk "sdb"
  Disk "sdc"
  Disk "sdd"

If it is value is a Hash it produces LoadPlugin section

collectd_conf 'plugin-hash-conf' do
  plugin 'python' => {'Globals' => true}
  conf 'Module' => 'SomeModule',
       'DeepConf' => {...}


  Globals true

  Module "SomeModule"

Repeation collectd_conf in different cookbooks and places for same plugin automatically merges all configuration together.
Use merge false to create standalone entry.

For logging plugins it is make sense to set priority above 10 so it appears earler in configuration.

Merge works only for plugins.


  • create - default, adds configuration to collectd
  • nothing - does nothing


  • plugin - plugin name to load. Can be String for name or Hash for LoadPlugin section. Defaults to nil
  • conf - configuration. If plugin set - confgiration for plugin else generic configuration. Defaults to nil
  • merge - merge or not configurations. Works only for plugins. Defaults to true
  • priority - weather plugin or section appears early or later in config. Generic sections are always after plugins. Defaults to 10


This cookbook heavy refactored but still not well tested. Also it supports only Debian. But you can implement your own installation and use this cookbook only for configuration.



  • Debian
  • Ubuntu


  • apt (Suggested but not required)
  • Conflicts with collectd


  • node['collectd']['packages'] - Defaults to %w(collectd-core).
  • node['collectd']['conf_dir'] - Defaults to /etc/collectd.
  • node['collectd']['base_dir'] - Defaults to /var/lib/collectd.
  • node['collectd']['plugin_dir'] - Defaults to /usr/lib/collectd.
  • node['collectd']['extra_conf_dir'] - Defaults to /etc/collectd/colectd.conf.d.
  • node['collectd']['types_db'] - Defaults to [ ... ].
  • node['collectd']['interval'] - Defaults to 10.
  • node['collectd']['timeout'] - Defaults to 2.
  • node['collectd']['read_threads'] - Defaults to 5.
  • node['collectd']['write_threads'] - Defaults to 5.
  • node['collectd']['write_queue_limit_high'] - Defaults to 1000000.
  • node['collectd']['write_queue_limit_low'] - Defaults to 900000.
  • node['collectd']['fqdn_lookup'] - Defaults to false.


  • collectd-lib::config
  • collectd-lib::default
  • collectd-lib::directories
  • collectd-lib::packages
  • collectd-lib::service

License and Maintainer

Maintainer:: Yauhen Artsiukhou (

License:: Apache 2.0

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

collectd-abiquo Applicable Versions

Foodcritic Metric

3.0.1 passed this metric