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
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
|
# File 'manifests/userparameters.pp', line 30
define zabbix::userparameters (
Enum['present', 'absent'] $ensure = 'present',
Optional[Stdlib::Filesource] $source = undef,
Optional[String[1]] $content = undef,
Optional[Stdlib::Filesource] $script = undef,
Optional[String[1]] $script_ext = undef,
Optional[String[1]] $template = undef,
Stdlib::Absolutepath $script_dir = '/usr/bin',
Stdlib::Filemode $config_mode = '0644',
) {
include zabbix::agent
$include_dir = $zabbix::agent::include_dir
$zabbix_package_agent = $zabbix::agent::zabbix_package_agent
$agent_config_owner = $zabbix::agent::agent_config_owner
$agent_config_group = $zabbix::agent::agent_config_group
$agent_servicename = $zabbix::agent::servicename
if $source {
file { "${include_dir}/${name}.conf":
ensure => $ensure,
owner => $agent_config_owner,
group => $agent_config_group,
mode => $config_mode,
source => $source,
notify => Service[$agent_servicename],
require => Package[$zabbix_package_agent],
}
}
if $content {
file { "${include_dir}/${name}.conf":
ensure => $ensure,
owner => $agent_config_owner,
group => $agent_config_group,
mode => $config_mode,
content => $content,
notify => Service[$agent_servicename],
require => Package[$zabbix_package_agent],
}
}
if $script {
file { "${script_dir}/${name}${script_ext}":
ensure => $ensure,
owner => $agent_config_owner,
group => $agent_config_group,
mode => '0755',
source => $script,
notify => Service[$agent_servicename],
require => Package[$zabbix_package_agent],
}
}
# If template is defined, it means we have an template in zabbix
# which needs to be loaded for this host. When exported resources is
# used/enabled, we do this automatically.
if $template {
zabbix::resources::userparameters { "${facts['networking']['hostname']}_${name}":
ensure => $ensure,
hostname => $facts['networking']['fqdn'],
template => $template,
}
}
}
|