diff options
Diffstat (limited to 'manifests/config.pp')
-rw-r--r-- | manifests/config.pp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/manifests/config.pp b/manifests/config.pp index 6736147..fba6836 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,10 +1,12 @@ +# Deploy check_mk config class check_mk::config ( $site, - $host_groups = undef, - $etc_dir = "/omd/sites/${site}/etc", - $nagios_subdir = 'nagios', - $bin_dir = "/omd/sites/${site}/bin", - $use_storedconfigs = true + $host_groups = undef, + $etc_dir = "/omd/sites/${site}/etc", + $nagios_subdir = 'nagios', + $bin_dir = "/omd/sites/${site}/bin", + $use_storedconfigs = true, + $inventory_only_on_changes = true ) { file { # for local check_mk checks @@ -13,11 +15,10 @@ class check_mk::config ( # package provided and check_mk generated files, defined so the nagios # module doesn't purge them + "${etc_dir}/${nagios_subdir}/conf.d": + ensure => directory; "${etc_dir}/${nagios_subdir}/conf.d/check_mk": ensure => directory; - [ "${etc_dir}/${nagios_subdir}/conf.d/check_mk/check_mk_objects.cfg", - "${etc_dir}/${nagios_subdir}/conf.d/check_mk/check_mk_templates.cfg" ]: - ensure => present; } file_line { 'nagios-add-check_mk-cfg_dir': ensure => present, @@ -57,9 +58,9 @@ class check_mk::config ( # local list of hosts is in /omd/sites/${site}/etc/check_mk/all_hosts_static and is appended concat::fragment { 'all-hosts-static': - ensure => "${etc_dir}/check_mk/all_hosts_static", - target => "${etc_dir}/check_mk/main.mk", - order => 18, + ensure => "${etc_dir}/check_mk/all_hosts_static", + target => "${etc_dir}/check_mk/main.mk", + order => 18, } # host_groups if $host_groups { @@ -78,27 +79,27 @@ class check_mk::config ( } $groups = keys($host_groups) check_mk::hostgroup { $groups: - dir => "${etc_dir}/nagios/local/hostgroups", - hostgroups => $host_groups, - target => "${etc_dir}/check_mk/main.mk", - notify => Exec['check_mk-refresh'] + dir => "${etc_dir}/nagios/local/hostgroups", + hostgroups => $host_groups, + target => "${etc_dir}/check_mk/main.mk", + notify => Exec['check_mk-refresh'] } } # local config is in /omd/sites/${site}/etc/check_mk/main.mk.local and is appended concat::fragment { 'check_mk-local-config': - ensure => "${etc_dir}/check_mk/main.mk.local", - target => "${etc_dir}/check_mk/main.mk", - order => 99, + ensure => "${etc_dir}/check_mk/main.mk.local", + target => "${etc_dir}/check_mk/main.mk", + order => 99, } # re-read config if it changes exec { 'check_mk-refresh': - command => "/bin/su -l -c '${bin_dir}/check_mk -I' ${site}", - refreshonly => true, + command => "/bin/su -l -c '${bin_dir}/check_mk -II' ${site}", + refreshonly => $inventory_only_on_changes, notify => Exec['check_mk-reload'], } exec { 'check_mk-reload': command => "/bin/su -l -c '${bin_dir}/check_mk -O' ${site}", - refreshonly => true, + refreshonly => $inventory_only_on_changes, } # re-read inventory at least daily exec { 'check_mk-refresh-inventory-daily': |