# Host definitions
#
# Autogenerated by Chef.

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

<% end -%>
<% @unmanaged_hosts.each do |n| -%>
define host {
  use server
  address <%= n['address'] %>
  host_name <%= n['id'] %>
  hostgroups <%= n['hostgroups'].join(",") %>
  notifications_enabled <%= n['notifications'] %>
}

<% end -%>
# Host definitions
#
# Autogenerated by Chef.

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

<% end -%>
<% @unmanaged_hosts.each do |n| -%>
define host {
  use server
  address <%= n['address'] %>
  host_name <%= n['id'] %>
  hostgroups <%= n['hostgroups'].join(",") %>
  notifications_enabled <%= n['notifications'] %>
}

<% end -%>
Remove the non-alerting host logic. It doesn't really work at the moment.
Remove the non-alerting host logic.  It doesn't really work at the moment.
