# Generated by Chef
# host definitions

define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['hostname'] %>
  hostgroups <%= node['nagios']['server_role'] %>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
  address <%= n['ipaddress'] %>
  host_name <%= n['hostname'] %>
<% if n.run_list.roles.nil? || n.run_list.roles.length == 0 -%>
  hostgroups all
<% elsif node['nagios']['multi_environment_monitoring'] == "true" -%>
	<% if node['nagios']['multi_os_monitoring'] == "true" -%>
		hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>,<%= n.os %>
	<% else -%>
	  hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>
	<% end -%>
<% elsif node['nagios']['multi_os_monitoring'] == "true" -%>
hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.os %>
<% else -%>
  hostgroups <%= n.run_list.roles.to_a.join(",") %>
<% end -%>
}
<% end -%>

<% end -%>

# Generated by Chef
# host definitions

define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['hostname'] %>
  hostgroups <%= node['nagios']['server_role'] %>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
	address <%= n['ipaddress'] %>
	host_name <%= n['hostname'] %>
<% if n.run_list.roles.nil? || n.run_list.roles.length == 0 -%>
	hostgroups all
<% elsif node['nagios']['multi_environment_monitoring'] == "true" -%>
<% if node['nagios']['multi_os_monitoring'] == "true" -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>,<%= n.os %>
<% else -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.chef_environment %>
<% end -%>
<% elsif node['nagios']['multi_os_monitoring'] == "true" -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>,<%= n.os %>
<% else -%>
	hostgroups <%= n.run_list.roles.to_a.join(",") %>
<% end -%>
}
<% end -%>

<% end -%>

Fix formatting so the ERB writes out correctly
Fix formatting so the ERB writes out correctly


Former-commit-id: a358d315b6eb27c916c12839cc12d17f8d5d68b4 [formerly 9b5c7dac31254afa9a497616162f6fa4622e87fd] [formerly c2c12c072c85a3d42ad11b3b9f1865f9a0e19571 [formerly d7b3d188c6d87880d64d62ae75ddad02273e8e4b [formerly 6a0453a7558815ed8a59c8b10c5b60d2e4c58906]]]
Former-commit-id: 6f8c8e9f0841c58384bb911fd7eefff1b941938b [formerly e354ad533208e8ab14fadf4ad5fe8516d4235140]
Former-commit-id: 31eca9b630e146ea01d196255ce3cb1ffecce5a8
Former-commit-id: f7ae813980ff1350feb4d55717605cb4e521502d