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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'manifests/feature/perfdata.pp', line 32
class icinga2::feature::perfdata (
Enum['absent', 'present'] $ensure = present,
Optional[Stdlib::Absolutepath] $host_perfdata_path = undef,
Optional[Stdlib::Absolutepath] $service_perfdata_path = undef,
Optional[Stdlib::Absolutepath] $host_temp_path = undef,
Optional[Stdlib::Absolutepath] $service_temp_path = undef,
Optional[String[1]] $host_format_template = undef,
Optional[String[1]] $service_format_template = undef,
Optional[Icinga2::Interval] $rotation_interval = undef,
Optional[Boolean] $enable_ha = undef,
) {
if ! defined(Class['icinga2']) {
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}
$conf_dir = $icinga2::globals::conf_dir
$_notify = $ensure ? {
'present' => Class['icinga2::service'],
default => undef,
}
# compose attributes
$attrs = {
'host_perfdata_path' => $host_perfdata_path,
'service_perfdata_path' => $service_perfdata_path,
'host_temp_path' => $host_temp_path,
'service_temp_path' => $service_temp_path,
'host_format_template' => $host_format_template,
'service_format_template' => $service_format_template,
'rotation_interval' => $rotation_interval,
'enable_ha' => $enable_ha,
}
# create object
icinga2::object { 'icinga2::object::PerfdataWriter::perfdata':
object_name => 'perfdata',
object_type => 'PerfdataWriter',
attrs => delete_undef_values($attrs),
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/perfdata.conf",
order => 10,
notify => $_notify,
}
# manage feature
icinga2::feature { 'perfdata':
ensure => $ensure,
}
}
|