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
63
64
65
|
# File 'manifests/module/monitoring/commandtransport.pp', line 27
define icingaweb2::module::monitoring::commandtransport (
String[1] $commandtransport = $title,
Enum['api', 'local'] $transport = 'api',
Stdlib::Host $host = 'localhost',
Stdlib::Port $port = 5665,
Optional[String[1]] $username = undef,
Optional[Icinga::Secret] $password = undef,
Stdlib::Absolutepath $path = '/var/run/icinga2/cmd/icinga2.cmd',
) {
$conf_dir = $icingaweb2::globals::conf_dir
$module_conf_dir = "${conf_dir}/modules/monitoring"
case $transport {
'api': {
$commandtransport_settings = {
'transport' => $transport,
'host' => $host,
'port' => $port,
'username' => $username,
'password' => unwrap($password),
}
}
'local': {
$commandtransport_settings = {
'transport' => $transport,
'path' => $path,
}
}
default: {
fail('The transport type you provided is not supported')
}
}
icingaweb2::inisection { "monitoring-commandtransport-${commandtransport}":
section_name => $commandtransport,
target => "${module_conf_dir}/commandtransports.ini",
settings => delete_undef_values($commandtransport_settings),
}
}
|