Forge Home

collectd

Puppet module for Collectd

227,373 downloads

50,429 latest version

2.7 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 4.0.1 (latest)
  • 4.0.0
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.1
  • 3.0.0
  • 2.1.0
  • 2.0.1
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 0.1.0
  • 0.0.5
  • 0.0.4
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Apr 14th 2014
This version is compatible with:
  • Puppet Enterprise 3.2.x
  • Puppet 3.x
  • , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'pdxcat-collectd', '2.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add pdxcat-collectd
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install pdxcat-collectd --version 2.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

pdxcat/collectd — version 2.0.1 Apr 14th 2014

Collectd module for Puppet

Build Status

Description

Puppet module for configuring collectd and plugins.

Usage

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.

Simple Plugins

Example of how to load plugins with no additional configuration:

collectd::plugin { 'battery': }

where 'battery' is the name of the plugin.

Configurable Plugins

Parameters will vary widely between plugins. See the collectd documentation for each plugin for configurable attributes.

####Class: collectd::plugin::amqp

class { 'collectd::plugin::amqp':
  amqphost => '127.0.0.1',
  amqpvhost => 'myvirtualhost',
  graphiteprefix => 'collectdmetrics',
  amqppersistent => true,
}

####Class: collectd::plugin::apache

class { 'collectd::plugin::apache':
  instances => {
    'apache80' => {
      'url' => 'http://localhost/mod_status?auto', 'user' => 'collectd', 'password' => 'hoh2Coo6'
    },
    'lighttpd8080' => {
      'url' => 'http://localhost:8080/mod_status?auto'
    }
  },
}

####Class: collectd::plugin::bind

class { 'collectd::plugin::bind':
  url    => 'http://localhost:8053/',
}

####Class: collectd::plugin::cpu

class { 'collectd::plugin::cpu':
}

####Class: collectd::plugin::csv

class { 'collectd::plugin::csv':
  datadir    => '/etc/collectd/var/lib/collectd/csv',
  storerates => false,
}

####Class: collectd::plugin::curl_json

collectd::plugin::curl_json {
  'rabbitmq_overview':
    url => 'http://localhost:55672/api/overview',
    instance => 'rabbitmq_overview',
    keys => {
      'message_stats/publish' => {'type' => 'gauge'},
    }
}

####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::entropy

collectd::plugin::entropy {
}

####Class: collectd::plugin::exec

collectd::plugin::exec {
  'dummy':
    user => nobody,
    group => nogroup,
    exec => ["/bin/echo", "PUTVAL myhost/foo/gauge-flat N:1"],
}

####Class: collectd::plugin::filecount

class { 'collectd::plugin::filecount':
  directories => {
    'active'   => '/var/spool/postfix/active',
    'incoming' => '/var/spool/postfix/incoming'
  },
}

####Class: collectd::plugin::interface

class { 'collectd::plugin::interface':
  interfaces     => ['lo'],
  ignoreselected => true
}

####Class: collectd::plugin::irq

class { 'collectd::plugin::irq':
  irqs           => ['7', '23'],
  ignoreselected => true,
}

####Class: collectd::plugin::iptables

class { 'collectd::plugin::iptables':
  chains  => {
    'nat'    => 'In_SSH',
    'filter' => 'HTTP'
  },
}

####Class: collectd::plugin::load

class { 'collectd::plugin::load':
}

####Class: collectd::plugin::libvirt

The interface_format parameter was introduced in collectd 5.0 and will therefore be ignored (with a warning) when specified with older versions.

class { 'collectd::plugin::libvirt':
  connection       => 'qemu:///system',
  interface_format => 'address'
}

####Class: collectd::plugin::memcached

class { 'collectd::plugin::memcached':
  host => '192.168.122.1',
  port => 11211,
}

####Class: collectd::plugin::memory

class { 'collectd::plugin::memory':
}

####Class: collectd::plugin::mysql

collectd::plugin::mysql::database { 'betadase':
  host        => 'localhost',
  username    => 'stahmna',
  password    => 'secret',
  port        => '3306',
  masterstats => true,
}

####Class: collectd::plugin::network

class { 'collectd::plugin::network':
}

####Class: collectd::plugin::nfs

class { 'collectd::plugin::nfs':
}

####Class: collectd::plugin::nginx

class { 'collectd::plugin::nginx':
  url      => 'https://localhost:8433',
  user     => 'stats',
  password => 'uleePi4A',
}

####Class: collectd::plugin::ntpd

class { 'collectd::plugin::ntpd':
  host           => 'localhost',
  port           => 123,
  reverselookups => false,
  includeunitid  => false,
}

####Class: collectd::plugin::openvpn

class { 'collectd::plugin::openvpn':
  collectindividualusers => false,
  collectusercount       => true,
}

####Class: collectd::plugin::ping

collectd::plugin::ping {
  'example':
    hosts => ['example.com'],
}

####Class: collectd::plugin::postgresql

class { 'collectd::plugin::postgresql':
  databases => {
    'postgres' => {
      'host'     => '/var/run/postgresql/',
      'user'     => 'postgres',
      'password' => 'postgres',
      'sslmode'  => 'disable',
      'query'    => [ 'query_plans', 'queries', 'table_states', 'disk_io' ],
    },
    'devdb' => {
      'host'     => 'host.example.com',
      'port'     => '5432',
      'user'     => 'postgres',
      'password' => 'secret',
      'sslmode'  => 'prefer',
    }
  }
}

####Class: collectd::plugin::processes

class { 'collectd::plugin::processes':
  processes => ['process1', 'process2'],
  process_matches => [
    { name => 'process-all', regex => 'process.*' }
  ],
}

####Class: collectd::plugin::python

collectd::plugin::python {
  'elasticsearch':
    modulepath    => '/usr/lib/collectd',
    module        => 'elasticsearch',
    script_source => 'puppet:///modules/myorg/elasticsearch_collectd_python.py',
    config        => {'Cluster' => 'elasticsearch'},
}

####Class: collectd::plugin::redis

class { 'collectd::plugin::redis':
  nodes => {
    'node1' => {
      'host'     => 'localhost',
    },
    'node2' => {
      'host'     => 'node2.example.com',
      'port'     => '6380',
      'timeout'  => 3000,
    }
  }
}

####Class: collectd::plugin::rrdcached

class { 'collectd::plugin::rrdcached':
  daemonaddress => 'unix:/var/run/rrdcached.sock',
  datadir       => '/var/lib/rrdcached/db/collectd',
}

####Class: collectd::plugin::rrdtool

class { 'collectd::plugin::rrdtool':
  datadir           => '/var/lib/collectd/rrd',
  createfilesasync  => false,
  rrarows           => 1200,
  rratimespan       => [3600, 86400, 604800, 2678400, 31622400],
  xff               => 0.1,
  cacheflush        => 900,
  cachetimeout      => 120,
  writespersecond   => 50
}

####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::swap

class { 'collectd::plugin::swap':
  reportbydevice => false,
  reportbytes    => true
}

####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::tail

collectd::plugin::tail::file { 'exim-log':
  filename => '/var/log/exim4/mainlog',
  instance => 'exim',
  matches  => [
    {
      regex    => 'S=([1-9][0-9]*)',
      dstype   => 'CounterAdd',
      type     => 'ipt_bytes',
      instance => 'total',
    },
    {
      regex    => '\\<R=local_user\\>',
      dstype   => 'CounterInc',
      type     => 'counter',
      instance => 'local_user',
    }
  ]
}

####Class: collectd::plugin::unixsock

class {'collectd::plugin::unixsock':
  socketfile  => '/var/run/collectd-sock',
  socketgroup => 'nagios',
}

####Class: collectd::plugin::uptime

class {'collectd::plugin::uptime':
}

####Class: collectd::plugin::users

class {'collectd::plugin::users':
}

####Class: collectd::plugin::varnish

class { 'collectd::plugin::varnish':
  instances => {
    'instanceName' => {
      'CollectCache' => 'true',
      'CollectBackend' => 'true',
      'CollectConnections' => 'true',
      'CollectSHM' => 'true',
      'CollectESI' => 'false',
      'CollectFetch' => 'true',
      'CollectHCB' => 'false',
      'CollectTotals' => 'true',
      'CollectWorkers' => 'true',
    }
  },
}

####Class: collectd::plugin::vmem

class { 'collectd::plugin::vmem':
  verbose => true,
}

####Class: collectd::plugin::write_graphite

class { 'collectd::plugin::write_graphite':
  graphitehost => 'graphite.examle.org',
}

####Class: collectd::plugin::write_network

Deprecated

class { 'collectd::plugin::write_network':
  servers => {
    'collect1.example.org' => { 'serverport' => '25826' },
    'collect2.example.org' => { 'serverport' => '25826' }
  }
}

####Class: collectd::plugin::write_riemann

class { 'collectd::plugin::write_riemann':
  riemann_host => 'riemann.example.org',
  riemann_port => 5555,
}

##Limitations

This module has been tested on Ubuntu Precise, CentOS 5/6, Solaris 10, and Debian 6/7.

##Development

Running tests

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