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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'manifests/pmlogger.pp', line 34
define pcp::pmlogger (
Enum['present', 'absent'] $ensure = 'present',
String $hostname = 'LOCALHOSTNAME',
Boolean $primary = false,
Boolean $socks = false,
String $log_dir = 'PCP_LOG_DIR/pmlogger/LOCALHOSTNAME',
String $args = '', # lint:ignore:params_empty_string_assignment
Optional[Stdlib::Absolutepath] $config_path = undef,
Optional[String] $config_content = undef,
Optional[String] $config_source = undef,
) {
include pcp
Class['pcp::install'] -> Pcp::Pmlogger[$title]
if $primary {
$_primary = 'y'
} else {
$_primary = 'n'
}
if $socks {
$_socks = 'y'
} else {
$_socks = 'n'
}
if $log_dir =~ /\$/ {
$_log_dir = "\"${log_dir}\""
} else {
$_log_dir = $log_dir
}
if $config_path {
$_args = "${args} -c ${config_path}"
} else {
$_args = $args
}
$_pmlogger_config_path = "/etc/pcp/pmlogger/control.d/${name}"
$_line = "#This file is managed by Puppet\n${hostname} ${_primary} ${_socks} ${_log_dir} ${_args}\n"
file { "pmlogger-${name}":
ensure => $ensure,
path => $_pmlogger_config_path,
owner => 'root',
group => 'root',
mode => '0644',
content => $_line,
notify => Service['pmlogger'],
}
if $config_path {
file { "pmlogger-${name}-config":
ensure => $ensure,
path => $config_path,
owner => 'root',
group => 'root',
mode => '0644',
content => $config_content,
source => $config_source,
notify => Service['pmlogger'],
before => File["pmlogger-${name}"],
}
}
}
|