summaryrefslogtreecommitdiff
path: root/puppet/modules/site_check_mk/templates
diff options
context:
space:
mode:
authorMicah Anderson <micah@leap.se>2014-12-02 11:26:35 -0500
committerMicah Anderson <micah@leap.se>2014-12-02 22:58:13 -0500
commita84272aa77715a4029ebd06b38b7a5ad05e6acd0 (patch)
treecd4d4c165ced4ec283fbeab0071daaf735c2be51 /puppet/modules/site_check_mk/templates
parenta3af7019efe6f5ff3daeeff474a8c31b1b3318c8 (diff)
Change nagios mail To: Header to contain the actual platform environment's contact email (Bug #6466)
Change-Id: Ib86ae771e0ac3b6f329a517a8a31c9ec54d33a05
Diffstat (limited to 'puppet/modules/site_check_mk/templates')
-rw-r--r--puppet/modules/site_check_mk/templates/host_contactgroups.mk17
-rw-r--r--puppet/modules/site_check_mk/templates/hostgroups.mk17
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") %>
]