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

RSS

collectd-lib (4) Versions 3.1.0

Install and configure the collectd monitoring daemon

Policyfile
Berkshelf
Knife
cookbook 'collectd-lib', '~> 3.1.0', :supermarket
cookbook 'collectd-lib', '~> 3.1.0'
knife supermarket install collectd-lib
knife supermarket download collectd-lib
README
Dependencies
Quality 17%

Description

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.

Usage

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

HWRP

collectd_conf

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.

Usage

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'
end

Result:

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
end

Result:

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] ]
end

Result:

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'
    }
  }
end

Result:

Key "value" SubKey "SubValue"

If key is a String and value is an Array of Hash it produces multiple sections with the same name.
ruby
collectd_conf 'string-hash-array' do
conf 'Section' => [
{'Key1' => 'Value1'},
{'Key2' => 'Value2'}
]
end

Result:

Key1 "Value1"
Key2 "Value2"

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'
  }
end

Result:


  Filter "*.conf"

One more:

collectd_conf 'curl' do
  plugin 'curl'
  conf %w(Page stock_quotes) => {
    'URL' => 'http://finance.google.com/finance?q=NYSE%3AAMD',
    'User' => 'foo',
    'Password' => 'bar',
    'Match' => { 'Regexp' => 'blabla.*', 'DsType' => 'GaugeAverage' }
  }
end

Produces:

LoadPlugin "curl"

  
    URL "http://finance.google.com/finance?q=NYSE%3AAMD"
    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'
end

Result:

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)
end

Result:

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' => {...}
end

Result:


  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.

Actions

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

Attributes

  • 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

NOTICE

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.

Requirements

Platform:

  • debian
  • ubuntu

Cookbooks:

  • Conflicts with collectd

Attributes

  • 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/collectd.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.

Recipes

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

License and Maintainer

Maintainer:: Yauhen Artsiukhou (jsirex@gmail.com)
Source:: https://github.com/jsirex/collectd-lib-cookbook
Issues:: https://github.com/jsirex/collectd-lib-cookbook/issues

License:: Apache 2.0

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

collectd-abiquo Applicable Versions

Collaborator Number Metric
            

3.1.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

3.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

3.1.0 failed this metric

FC085: Resource using new_resource.updated_by_last_action to converge resource: collectd-lib/libraries/collectd_conf_accumulator.rb:80
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

3.1.0 passed this metric

Testing File Metric
            

3.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

3.1.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number