File: filter.pp

package info (click to toggle)
puppet-module-voxpupuli-collectd 11.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,308 kB
  • sloc: ruby: 8,119; python: 30; sh: 10; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (2)
1
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
# https://collectd.org/wiki/index.php/Chains
class collectd::plugin::filter (
  $ensure          = 'present',
  $precachechain   = 'PreChain',
  $postcachechain  = 'PostChain',
) {
  include collectd

  $plugin_matches = ['regex','timediff','value','empty_counter','hashed']
  $plugin_targets = ['notification','replace','set','scale']
  $conf_file = "${collectd::plugin_conf_dir}/01-filter.conf"

  file { $conf_file:
    ensure  => $ensure,
    owner   => $collectd::config_owner,
    group   => $collectd::config_group,
    mode    => $collectd::config_mode,
    content => "PreCacheChain \"${precachechain}\"\nPostCacheChain \"${postcachechain}\"\n\n",
    notify  => Service[$collectd::service_name],
  }

  unless $ensure == 'present' {
    #kick all filter specifc plugins
    ensure_resource('collectd::plugin', prefix($plugin_matches,'match_'), { 'ensure' => 'absent', 'order' => '02'} )
    ensure_resource('collectd::plugin', prefix($plugin_targets,'target_'), { 'ensure' => 'absent', 'order' => '02'} )
  }

}