# 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.


Former-commit-id: f9aff2dea6756579b8c6c44b7a1cd16b3cce9eb7 [formerly d3a0cd2f64aea69957f8accb8f8b5f0c343c0acd] [formerly c4896aed3c3c5295f5116ac47705d330d8bee242 [formerly aeac4ea19f3d5c30d6a3b47d4407452dbe8db2c6 [formerly 71fc97b5211e54274ae03c5d9e85cc66f37ca8d0]]]
Former-commit-id: 064bfc938b99430523a71d9f28ac56083fdd508a [formerly 94e48c6bcb140887a804e36e71909da9f22228dc]
Former-commit-id: a66ae19fd9c4173ed5ce4c126d326f8d3099614f
Former-commit-id: 9af67a8fe510ae107b243247fc09f5c06d3443f5