Defined Type: collectd::plugin::python::module

Defined in:
manifests/plugin/python/module.pp

Overview

Single module definition

Parameters:

  • config (Any) (defaults to: [])
  • ensure (Any) (defaults to: 'present')
  • module (Any) (defaults to: $title)
  • modulepath (Any) (defaults to: undef)
  • script_source (Any) (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
# File 'manifests/plugin/python/module.pp', line 2

define collectd::plugin::python::module (
  $config        = [],
  $ensure        = 'present',
  $module        = $title,
  $modulepath    = undef,
  $script_source = undef,
) {

  include ::collectd
  include ::collectd::plugin::python

  validate_array($config)

  $module_dir = $modulepath ? {
    undef   => $collectd::python_dir,
    default => $modulepath
  }
  validate_absolute_path($module_dir)

  if $script_source {
    file { "${module}.script":
      ensure  => $ensure,
      path    => "${module_dir}/${module}.py",
      owner   => 'root',
      group   => $collectd::root_group,
      mode    => '0640',
      source  => $script_source,
      require => File[$module_dir],
      notify  => Service['collectd'],
    }
  }

  concat::fragment{ "collectd_plugin_python_conf_${module}":
    order   => '50', # somewhere between header and footer
    target  => $collectd::plugin::python::python_conf,
    content => template('collectd/plugin/python/module.conf.erb'),
  }
}