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)
  • flushinterval (Optional[Integer]) (defaults to: undef)


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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'manifests/plugin.pp', line 2

define collectd::plugin (
  $ensure   = 'present',
  $content  = undef,
  $order    = '10',
  $globals  = false,
  $interval = undef,
  $plugin   = $name,
  Optional[Integer] $flushinterval = undef,
) {
  include collectd

  $conf_dir = $collectd::plugin_conf_dir
  $config_group = $collectd::config_group

  $plugin_package = "collectd-${plugin}"
  $flush_require = defined(Package[$plugin_package]) ? {
    true    => Package[$plugin_package],
    default => undef
  }

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

  # 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::service_name],
    require => $flush_require,
  }

  # 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::service_name],
      require => $flush_require,
    }
  }

  # Delete default config file created by platform packaging and not matching
  # plugin name
  if ($plugin in $collectd::package_configs) {
    file { "package_${plugin}.load":
      ensure  => absent,
      path    => "${conf_dir}/${collectd::package_configs[$plugin]}",
      notify  => Service[$collectd::service_name],
      require => $flush_require,
    }
  }
}