diff options
author | Varac <varac@leap.se> | 2014-12-04 17:30:07 +0800 |
---|---|---|
committer | Gerrit Code Review <gerrit2@review.leap.se> | 2014-12-04 17:30:07 +0800 |
commit | 60bd76583d46fe1c9f39804c7fd892fa9c1745d0 (patch) | |
tree | e938e8bc993104715c79595af313f9d8485f5125 /puppet/modules/site_check_mk/templates | |
parent | acd6dd2848f38ba1b728f263f297bc6d2ad9e4bb (diff) | |
parent | a84272aa77715a4029ebd06b38b7a5ad05e6acd0 (diff) |
Merge "Change nagios mail To: Header to contain the actual platform environment's contact email (Bug #6466)" into develop
Diffstat (limited to 'puppet/modules/site_check_mk/templates')
-rw-r--r-- | puppet/modules/site_check_mk/templates/host_contactgroups.mk | 17 | ||||
-rw-r--r-- | puppet/modules/site_check_mk/templates/hostgroups.mk | 17 |
2 files changed, 32 insertions, 2 deletions
diff --git a/puppet/modules/site_check_mk/templates/host_contactgroups.mk b/puppet/modules/site_check_mk/templates/host_contactgroups.mk new file mode 100644 index 00000000..6a534967 --- /dev/null +++ b/puppet/modules/site_check_mk/templates/host_contactgroups.mk @@ -0,0 +1,17 @@ +<% + contact_groups = [] + @environments.keys.sort.each do |env_name| + hosts = "" + @nagios_hosts.keys.sort.each do |hostname| + hostdata = @nagios_hosts[hostname] + domain_internal = hostdata['domain_internal'] + if hostdata['environment'] == env_name + hosts << '"' + domain_internal + '", ' + end + end + contact_groups << ' ( "%s", [%s] )' % [env_name, hosts] + end +%> +host_contactgroups = [ +<%= contact_groups.join(",\n") %> +] diff --git a/puppet/modules/site_check_mk/templates/hostgroups.mk b/puppet/modules/site_check_mk/templates/hostgroups.mk index 79b7f92f..7158dcd1 100644 --- a/puppet/modules/site_check_mk/templates/hostgroups.mk +++ b/puppet/modules/site_check_mk/templates/hostgroups.mk @@ -1,4 +1,17 @@ +<% + host_groups = [] + @environments.keys.sort.each do |env_name| + hosts = "" + @nagios_hosts.keys.sort.each do |hostname| + hostdata = @nagios_hosts[hostname] + domain_internal = hostdata['domain_internal'] + if hostdata['environment'] == env_name + hosts << '"' + domain_internal + '", ' + end + end + host_groups << ' ( "%s", [%s] )' % [env_name, hosts] + end +%> host_groups = [ - <% @domains_internal.each do |domain| %>( '<%= domain %>', [<% @nagios_hosts.keys.sort.each do |key| -%><% if @nagios_hosts[key]['domain_internal'] == key+'.'+domain -%>'<%= key %>.<%= domain %>', <% end -%><% end -%>] ), - <% end -%> +<%= host_groups.join(",\n") %> ] |