forked from voxpupuli/puppet-collectd
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.pp
62 lines (56 loc) · 2.27 KB
/
config.pp
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
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
# private
class collectd::config (
$collectd_hostname = $collectd::collectd_hostname,
Stdlib::Absolutepath $config_file = $collectd::config_file,
$conf_content = $collectd::conf_content,
Boolean $fqdnlookup = $collectd::fqdnlookup,
Boolean $has_wordexp = $collectd::has_wordexp,
Array $include = $collectd::include,
Boolean $internal_stats = $collectd::internal_stats,
Integer $interval = $collectd::interval,
Stdlib::Absolutepath $plugin_conf_dir = $collectd::plugin_conf_dir,
$plugin_conf_dir_mode = $collectd::plugin_conf_dir_mode,
$recurse = $collectd::recurse,
$root_group = $collectd::root_group,
$purge = $collectd::purge,
Boolean $purge_config = $collectd::purge_config,
Integer $read_threads = $collectd::read_threads,
Integer $timeout = $collectd::timeout,
Array $typesdb = $collectd::typesdb,
$write_queue_limit_high = $collectd::write_queue_limit_high,
$write_queue_limit_low = $collectd::write_queue_limit_low,
Integer $write_threads = $collectd::write_threads,
) {
$_conf_content = $purge_config ? {
true => template('collectd/collectd.conf.erb'),
default => $conf_content,
}
file { 'collectd.conf':
path => $config_file,
content => $_conf_content,
}
if $purge_config != true and !$_conf_content {
# former include of conf_d directory
file_line { 'include_conf_d':
ensure => absent,
line => "Include \"${plugin_conf_dir}/\"",
path => $config_file,
}
# include (conf_d directory)/*.conf
file_line { 'include_conf_d_dot_conf':
ensure => present,
line => "Include \"${plugin_conf_dir}/*.conf\"",
path => $config_file,
}
}
file { 'collectd.d':
ensure => directory,
path => $plugin_conf_dir,
mode => $plugin_conf_dir_mode,
owner => 'root',
group => $root_group,
purge => $purge,
recurse => $recurse,
}
File['collectd.d'] -> Concat <| tag == 'collectd' |>
}