From 8d77d623106d5e5edd52c086568d5caa1cb87413 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 4 Mar 2014 16:40:27 +0100 Subject: use check_mk::server::collect_hosts for collecting storedconfig nodes --- manifests/config.pp | 16 +++++++++------- manifests/init.pp | 10 ++++++---- manifests/server/collect_hosts.pp | 6 ++++++ 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 manifests/server/collect_hosts.pp diff --git a/manifests/config.pp b/manifests/config.pp index f764397..6a6f375 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,9 +1,10 @@ class check_mk::config ( $site, - $host_groups = undef, - $etc_dir = "/omd/sites/${site}/etc", - $nagios_subdir = 'nagios', - $bin_dir = "/omd/sites/${site}/bin" + $host_groups = undef, + $etc_dir = "/omd/sites/${site}/etc", + $nagios_subdir = 'nagios', + $bin_dir = "/omd/sites/${site}/bin", + $use_storedconfigs = true ) { file { "${etc_dir}/${nagios_subdir}/local": ensure => directory, @@ -38,10 +39,11 @@ class check_mk::config ( content => "]\n", order => 19, } - Check_mk::Host <<| |>> { - target => "${etc_dir}/check_mk/main.mk", - notify => Exec['check_mk-refresh'] + if ( $use_storedconfigs ) { + class { 'check_mk::server::collect_hosts': } } + + # 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", diff --git a/manifests/init.pp b/manifests/init.pp index 999541d..7296941 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,7 +10,8 @@ class check_mk ( $omdadmin_htpasswd = undef, $use_ssh = false, $shelluser = 'monitoring', - $shellgroup = 'monitoring' ) { + $shellgroup = 'monitoring', + $use_storedconfigs = true ) { class { 'check_mk::install': filestore => $filestore, @@ -19,9 +20,10 @@ class check_mk ( workspace => $workspace, } class { 'check_mk::config': - host_groups => $host_groups, - site => $site, - require => Class['check_mk::install'], + host_groups => $host_groups, + site => $site, + use_storedconfigs => $use_storedconfigs, + require => Class['check_mk::install'], } class { 'check_mk::service': require => Class['check_mk::config'], diff --git a/manifests/server/collect_hosts.pp b/manifests/server/collect_hosts.pp new file mode 100644 index 0000000..6d07897 --- /dev/null +++ b/manifests/server/collect_hosts.pp @@ -0,0 +1,6 @@ +class check_mk::server::collect_hosts { + Check_mk::Host <<| |>> { + target => "${::check_mk::config::etc_dir}/check_mk/main.mk", + notify => Exec['check_mk-refresh'] + } +} -- cgit v1.2.3