# 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 & @hostgroups).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 -%>

<% unless @unmanaged_hosts.nil? -%>
<% @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 -%>
<% end -%>
# Host definitions
#
# Autogenerated by Chef.

<% @nodes.each do |n| -%>
define host {
  use server
  address <%= (!n['cloud'].nil? && n['cloud'] != node['cloud']) ? n['cloud']['public_ipv4'] : 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 & @hostgroups).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 -%>

<% unless @unmanaged_hosts.nil? -%>
<% @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 -%>
<% end -%>
Add an upstream pull request for ec2 internal IPs to the hosts template in Nagios
Add an upstream pull request for ec2 internal IPs to the hosts template in Nagios


Former-commit-id: ca2ca6cc2b8b65acbaf7d647f7ccb0bc8d4b0165 [formerly 5a76dcea11c10a3da03aa1dcc7891ec11d900b8f] [formerly 58fa3f172b9447ed6a326256ad4ac78a698839fe [formerly 6cf8dd5441e27d9fe16155b09e0b55cfbcea1f0c [formerly 2b7bd30991c32369eea584944a0114ea86594150]]]
Former-commit-id: 3ea81a7035a7e40615b9e9735f1f95c03068d9b4 [formerly fd0154b29402d38b4b3992f38365aac7881b0da0]
Former-commit-id: eeee2c391443da79fa8a086904e2514f918cd764
Former-commit-id: f1423b2d28be0f3653d1ed58898fbd8ae972a6f6