diff options
author | Keith Burdis <keith@burdis.org> | 2013-02-09 08:51:44 +0000 |
---|---|---|
committer | Keith Burdis <keith@burdis.org> | 2013-02-09 08:51:44 +0000 |
commit | 0769984c3e3fbac826332420c044b691b5d11f8b (patch) | |
tree | e3153d18e9153c2125634902da14eb10c3499673 /manifests | |
parent | 07b0b601cfb9ad4224e3b65fccb736bc5c93f41d (diff) |
* Added host tags to agent config so that host groups can be auto-populated
* Fixed incorrect package name when using a file store that was causing the
package existence check to fail always causing an often failing reinstall
* Enable a static list of hosts to be specified for those without the Puppet
check_mk module installed
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/agent.pp | 5 | ||||
-rw-r--r-- | manifests/config.pp | 8 | ||||
-rw-r--r-- | manifests/hostgroup.pp | 10 | ||||
-rw-r--r-- | manifests/init.pp | 14 |
4 files changed, 27 insertions, 10 deletions
diff --git a/manifests/agent.pp b/manifests/agent.pp index dc13388..b53882a 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -1,5 +1,6 @@ class check_mk::agent ( $filestore = undef, + $host_tags = undef, $ip_whitelist = undef, $port = '6556', $server_dir = '/usr/bin', @@ -22,5 +23,7 @@ class check_mk::agent ( require => Class['check_mk::agent::install'], } include check_mk::agent::service - @@check_mk::host { $::fqdn: } + @@check_mk::host { $::fqdn: + host_tags => $host_tags, + } } diff --git a/manifests/config.pp b/manifests/config.pp index edd14d9..73e4882 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -41,6 +41,12 @@ class check_mk::config ( target => "${etc_dir}/check_mk/main.mk", notify => Exec['check_mk-refresh'] } + # 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, + } # host_groups if $host_groups { file { "${etc_dir}/nagios/local/hostgroups": @@ -59,7 +65,7 @@ class check_mk::config ( $groups = keys($host_groups) check_mk::hostgroup { $groups: dir => "${etc_dir}/nagios/local/hostgroups", - host_groups => $host_groups, + hostgroups => $host_groups, target => "${etc_dir}/check_mk/main.mk", notify => Exec['check_mk-refresh'] } diff --git a/manifests/hostgroup.pp b/manifests/hostgroup.pp index ac66a16..baec45f 100644 --- a/manifests/hostgroup.pp +++ b/manifests/hostgroup.pp @@ -4,15 +4,21 @@ define check_mk::hostgroup ( $target, ) { $group = $title - $group_tags = join($hostgroups[$group], ',') + $group_tags = sprintf("'%s'", join($hostgroups[$group]['host_tags'], "', '")) concat::fragment { "check_mk-hostgroup-${group}": target => $target, content => " ( '${group}', [ ${group_tags} ], ALL_HOSTS ),\n", order => 21, } + if $hostgroups[$group]['description'] { + $description = $hostgroups[$group]['description'] + } + else { + $description = regsubst($group, '_', ' ') + } file { "${dir}/${group}.cfg": ensure => present, - content => "define hostgroup {\n hostgroup_name ${group}\n}\n", + content => "define hostgroup {\n hostgroup_name ${group}\n alias ${description}\n}\n", require => File[$dir], } } diff --git a/manifests/init.pp b/manifests/init.pp index 2686f55..24e4e0d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,8 +1,9 @@ class check_mk ( - $filestore = undef, - $package = 'omd', - $site = 'monitoring', - $workspace = '/root/check_mk', + $filestore = undef, + $host_groups = undef, + $package = 'omd-0.56', + $site = 'monitoring', + $workspace = '/root/check_mk', ) { class { 'check_mk::install': filestore => $filestore, @@ -11,8 +12,9 @@ class check_mk ( workspace => $workspace, } class { 'check_mk::config': - site => $site, - require => Class['check_mk::install'], + host_groups => $host_groups, + site => $site, + require => Class['check_mk::install'], } class { 'check_mk::service': require => Class['check_mk::config'], |