Add parameters to the monitoring module class for more flexibility.

This commit is contained in:
Eric Zounes 2016-01-14 13:18:06 -08:00 committed by Tom De Vylder
parent eb61819522
commit 167a752af7

View file

@ -1,6 +1,11 @@
# == Class icingaweb2::mod::monitoring
#
class icingaweb2::mod::monitoring (
$protected_customvars = '*pw*,*pass*,community',
$backend_type = 'ido',
$backend_resource = 'icinga_ido',
$transport = 'local',
$transport_path = '/var/run/icinga2/cmd/icinga2.cmd',
) {
require ::icingaweb2
@ -26,6 +31,16 @@ class icingaweb2::mod::monitoring (
mode => $::icingaweb2::config_dir_mode;
}
$monitoring_mod_files = [
"${::icingaweb2::config_dir}/modules/monitoring/backends.ini",
"${::icingaweb2::config_dir}/modules/monitoring/config.ini",
"${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini",
]
file { $monitoring_mod_files:
ensure => present,
}
Ini_Setting {
ensure => present,
require => File["${::icingaweb2::config_dir}/modules/monitoring"],
@ -34,35 +49,35 @@ class icingaweb2::mod::monitoring (
ini_setting { 'security settings':
section => 'security',
setting => 'protected_customvars',
value => '"*pw*,*pass*,community"',
value => "\"${protected_customvars}\"",
path => "${::icingaweb2::config_dir}/modules/monitoring/config.ini",
}
ini_setting { 'backend ido setting':
section => 'icinga_ido',
setting => 'type',
value => 'ido',
value => $backend_type,
path => "${::icingaweb2::config_dir}/modules/monitoring/backends.ini",
}
ini_setting { 'backend resource setting':
section => 'icinga_ido',
setting => 'resource',
value => 'icinga_ido',
value => $backend_resource,
path => "${::icingaweb2::config_dir}/modules/monitoring/backends.ini",
}
ini_setting { 'command transport setting':
section => 'icinga2',
setting => 'transport',
value => 'local',
value => $transport,
path => "${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini",
}
ini_setting { 'command transport path setting':
section => 'icinga2',
setting => 'path',
value => '/var/run/icinga2/cmd/icinga2.cmd',
value => $transport_path,
path => "${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini",
}