Puppet module for configuring collectd and plugins.
The simplest use case is to use all of the configurations in the default collectd.conf file shipped with collectd. This can be done by simply including the class:
include collectd
Collectd is most useful when configured with customized plugins. This is accomplished by removing the default collectd.conf file and replacing it with a file that includes all alternative configurations. Configure a node with the following class declaration:
class { '::collectd':
purge => true,
recurse => true,
purge_config => true,
}
Set purge, recurse, and purge_config to true in order to override the default configurations shipped in collectd.conf and use custom configurations stored in conf.d. From here you can set up additional plugins as shown below.
Example of how to load plugins with no additional configuration:
collectd::plugin { 'battery': }
where 'battery' is the name of the plugin.
Parameters will vary widely between plugins. See the collectd documentation for each plugin for configurable attributes.
bind
df
(see collectd::plugin::df below)disk
(see collectd::plugin::disk below)filecount
(see collectd::plugin::filecount below)interface
iptables
irq
memcached
(see collectd::plugin::memcached below )mysql
(see collectd::plugin::mysql below)network
nginx
openvpn
(see collectd::plugin::openvpn below)snmp
(see collectd::plugin::snmp below)syslog
(see collectd::plugin::sylog below)tcpconns
(see collectd::plugin::tcpconns below)unixsock
(see collectd::plugin::unixsock below)write_graphite
(see collectd::plugin::write_graphite below)
####Class: collectd::plugin::df
class { 'collectd::plugin::df':
mountpoints => ['/u'],
fstypes => ['nfs','tmpfs','autofs','gpfs','proc','devpts'],
ignoreselected => 'true',
}
####Class: collectd::plugin::disk
class { 'collectd::plugin::disk':
disks => ['/^dm/'],
ignoreselected => 'true'
}
####Class: collectd::plugin::filecount
class { 'collectd::plugin::filecount':
directories => {
'active' => '/var/spool/postfix/active',
'incoming' => '/var/spool/postfix/incoming'
},
}
####Class: collectd::plugin::memcached
class { 'collectd::plugin::memcached':
host => '192.168.122.1',
port => '11211',
}
####Class: collectd::plugin::mysql
class { 'collectd::plugin::mysql':
database => 'betadase',
host => 'localhost',
username => 'stahmna',
password => 'secret',
port => '3306',
}
####Class: collectd::plugin::openvpn
class { 'collectd::plugin::openvpn':
collectindividualusers => 'false',
collectusercount => 'true',
}
####Class: collectd::plugin::snmp
class {'collectd::plugin::snmp':
data => {
amavis_incoming_messages => {
'Type' => 'counter',
'Table' => false,
'Instance' => 'amavis.inMsgs',
'Values' => ['AMAVIS-MIB::inMsgs.0']
}
},
hosts => {
debianvm => {
'Address' => '127.0.0.1',
'Version' => 2,
'Community' => 'public',
'Collect' => ['amavis_incoming_messages'],
'Interval' => 10
}
},
}
####Class: collectd::plugin::syslog
class { 'collectd::plugin::syslog':
log_level => 'warning'
}
####Class: collectd::plugin::tcpconns
class { 'collectd::plugin::tcpconns':
localports => ['25', '12026'],
remoteports => ['25'],
listening => false,
}
####Class: collectd::plugin::unixsock
class {'collectd::plugin::unixsock':
socketfile => '/var/run/collectd-sock',
socketgroup => 'nagios',
}
####Class: collectd::plugin::write_graphite
class { 'collectd::plugin::write_graphite':
graphitehost => 'graphite.examle.org',
}
##Limitations
This module has been tested on Ubuntu Precise, CentOS 5/6, Solaris 10, and Debian 6/7.
##Development
This project contains tests for both rspec-puppet and rspec-system to verify functionality. For in-depth information please see their respective documentation.
Quickstart:
gem install bundler
bundle install
bundle exec rake spec
bundle exec rake spec:system