Defined Type: collectd::plugin

Defined in:
manifests/plugin.pp

Overview

Parameters:

  • ensure (Any) (defaults to: 'present')
  • content (Any) (defaults to: undef)
  • order (Any) (defaults to: '10')
  • globals (Any) (defaults to: false)
  • interval (Any) (defaults to: undef)
  • plugin (Any) (defaults to: $name)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'manifests/plugin.pp', line 2

define collectd::plugin (
  $ensure   = 'present',
  $content  = undef,
  $order    = '10',
  $globals  = false,
  $interval = undef,
  $plugin   = $name
) {

  include ::collectd

  $conf_dir = $::collectd::plugin_conf_dir
  $root_group = $::collectd::root_group

  file { "${plugin}.load":
    ensure  => $ensure,
    path    => "${conf_dir}/${order}-${plugin}.conf",
    owner   => root,
    group   => $root_group,
    mode    => '0640',
    content => template('collectd/loadplugin.conf.erb'),
    notify  => Service['collectd'],
  }

  # Older versions of this module didn't use the "00-" prefix.
  # Delete those potentially left over files just to be sure.
  file { "older_${plugin}.load":
    ensure => absent,
    path   => "${conf_dir}/${plugin}.conf",
    notify => Service['collectd'],
  }

  # Older versions of this module use the "00-" prefix by default.
  # Delete those potentially left over files just to be sure.
  if $order != '00' {
    file { "old_${plugin}.load":
      ensure => absent,
      path   => "${conf_dir}/00-${plugin}.conf",
      notify => Service['collectd'],
    }
  }
}