<commit_before># Host definitions
#
# Autogenerated by Chef.

<%# handle the nagios node differently than others to prevent failures in bootstrap scenarios %>
define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? node[node['nagios']['host_name_attribute']].downcase : node[node['nagios']['host_name_attribute']] %>
  hostgroups <% if node['nagios']['multi_environment_monitoring'] -%><%= node.chef_environment %>,<% end -%>all,<%= node['os'] %>,<%= node['roles'].sort.join(",") %><% if !node['roles'].include?(node['nagios']['server_role']) %>,<%= node['nagios']['server_role'] %><% end -%>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
  <% # decide whether to use internal or external IP addresses for this node
  # if the nagios server is not in the cloud, always use public IP addresses for cloud nodes.
  # if the nagios server is in the cloud, use private IP addresses for any
  #   cloud servers in the same cloud, public IPs for servers in other clouds
  #   (where other is defined by node['cloud']['provider'])
  # if the cloud IP is nil then use the standard IP address attribute.  This is a work around
  #   for OHAI incorrectly identifying systems on Cisco hardware as being in Rackspace
  # If the attribute node['nagios']['myip'] is defined, use it as the host IP and ignore any ohai attribute
  if n.has_key?('nagios') and n['nagios'].has_key?('override_ip') and n['nagios']['override_ip'] != nil
    ip = n['nagios']['override_ip']
  else
    if node['cloud'].nil? && !n['cloud'].nil?
      ip = !n['cloud']['public_ipv4'].nil? && n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']
    elsif !node['cloud'].nil? && !n['cloud'].nil? && n['cloud']['provider'] != node['cloud']['provider']
      ip = !n['cloud']['public_ipv4'].nil? && n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']
    else
      ip = n['ipaddress']
    end
  end %>
  <% unless ip.empty? -%>
  address <%= ip %>
  <% end %>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? n[node['nagios']['host_name_attribute']].downcase : n[node['nagios']['host_name_attribute']] %>
  <% if node['nagios']['multi_environment_monitoring'] -%>
  <% if n['roles'].nil? || n['roles'].length == 0 -%>
  hostgroups all,<%= n['os'] %>, <%= n.chef_environment %>
  <% else -%>
  hostgroups all,<%= (n['roles'] & @hostgroups).sort.join(",") %>,<%= n['os'] %>, <%= n.chef_environment %>
  <% end -%>
  <% elsif -%>
  <% if n['roles'].nil? || n['roles'].length == 0 -%>
  hostgroups all,<%= n['os'] %>
  <% else -%>
  hostgroups all,<%= (n['roles'] & @hostgroups).sort.join(",") %>,<%= n['os'] %>
  <% end -%>
  <% end -%>
  <% if !n.run_list.roles.nil? && n.run_list.roles.include?("private") -%>
  # Disable active host checks if in role "private"
  active_checks_enabled 0
  <% end -%>
  <% if !n['nagios'].nil? && !n['nagios']['contact_groups'].nil? -%>
  contact_groups <%= n['nagios']['contact_groups'] %>
  <% end -%>
  <% if !n['nagios'].nil? && !n['nagios']['contacts'].nil? -%>
  contacts <%= n['nagios']['contacts'] %>
  <% end -%>
}
<% end -%>
<% end -%>

<% unless @unmanaged_hosts.nil? -%>
<% @unmanaged_hosts.each do |n| -%>
define host {
  use server
  address <%= n['address'] %>
  <% if n.has_key?("nagios_name") -%>
  host_name <%= n['nagios_name'] %>
  <% else -%>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? n['id'].downcase : n['id'] %>
  <% end -%>
  hostgroups all,<%= n['hostgroups'].join(",") %>
  notifications_enabled <%= n['notifications'] %>
  <% if n['hostgroups'].include?("private") -%>
  # Disable active host checks if in role "private"
  active_checks_enabled 0
  <% end -%>
}
<% end -%>
<% end -%><commit_msg>Include contact_groups attribute in nagios_unmanaged_hosts<commit_after># Host definitions
#
# Autogenerated by Chef.

<%# handle the nagios node differently than others to prevent failures in bootstrap scenarios %>
define host {
  use server
  address <%= node['ipaddress'] %>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? node[node['nagios']['host_name_attribute']].downcase : node[node['nagios']['host_name_attribute']] %>
  hostgroups <% if node['nagios']['multi_environment_monitoring'] -%><%= node.chef_environment %>,<% end -%>all,<%= node['os'] %>,<%= node['roles'].sort.join(",") %><% if !node['roles'].include?(node['nagios']['server_role']) %>,<%= node['nagios']['server_role'] %><% end -%>
}

<% @nodes.each do |n| -%>
<% unless n.name == node.name -%>
define host {
  use server
  <% # decide whether to use internal or external IP addresses for this node
  # if the nagios server is not in the cloud, always use public IP addresses for cloud nodes.
  # if the nagios server is in the cloud, use private IP addresses for any
  #   cloud servers in the same cloud, public IPs for servers in other clouds
  #   (where other is defined by node['cloud']['provider'])
  # if the cloud IP is nil then use the standard IP address attribute.  This is a work around
  #   for OHAI incorrectly identifying systems on Cisco hardware as being in Rackspace
  # If the attribute node['nagios']['myip'] is defined, use it as the host IP and ignore any ohai attribute
  if n.has_key?('nagios') and n['nagios'].has_key?('override_ip') and n['nagios']['override_ip'] != nil
    ip = n['nagios']['override_ip']
  else
    if node['cloud'].nil? && !n['cloud'].nil?
      ip = !n['cloud']['public_ipv4'].nil? && n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']
    elsif !node['cloud'].nil? && !n['cloud'].nil? && n['cloud']['provider'] != node['cloud']['provider']
      ip = !n['cloud']['public_ipv4'].nil? && n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']
    else
      ip = n['ipaddress']
    end
  end %>
  <% unless ip.empty? -%>
  address <%= ip %>
  <% end %>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? n[node['nagios']['host_name_attribute']].downcase : n[node['nagios']['host_name_attribute']] %>
  <% if node['nagios']['multi_environment_monitoring'] -%>
  <% if n['roles'].nil? || n['roles'].length == 0 -%>
  hostgroups all,<%= n['os'] %>, <%= n.chef_environment %>
  <% else -%>
  hostgroups all,<%= (n['roles'] & @hostgroups).sort.join(",") %>,<%= n['os'] %>, <%= n.chef_environment %>
  <% end -%>
  <% elsif -%>
  <% if n['roles'].nil? || n['roles'].length == 0 -%>
  hostgroups all,<%= n['os'] %>
  <% else -%>
  hostgroups all,<%= (n['roles'] & @hostgroups).sort.join(",") %>,<%= n['os'] %>
  <% end -%>
  <% end -%>
  <% if !n.run_list.roles.nil? && n.run_list.roles.include?("private") -%>
  # Disable active host checks if in role "private"
  active_checks_enabled 0
  <% end -%>
  <% if !n['nagios'].nil? && !n['nagios']['contact_groups'].nil? -%>
  contact_groups <%= n['nagios']['contact_groups'] %>
  <% end -%>
  <% if !n['nagios'].nil? && !n['nagios']['contacts'].nil? -%>
  contacts <%= n['nagios']['contacts'] %>
  <% end -%>
}
<% end -%>
<% end -%>

<% unless @unmanaged_hosts.nil? -%>
<% @unmanaged_hosts.each do |n| -%>
define host {
  use server
  address <%= n['address'] %>
  <% if n.has_key?("nagios_name") -%>
  host_name <%= n['nagios_name'] %>
  <% else -%>
  host_name <%= node['nagios']['server']['normalize_hostname'] ? n['id'].downcase : n['id'] %>
  <% end -%>
  hostgroups all,<%= n['hostgroups'].join(",") %>
  notifications_enabled <%= n['notifications'] %>
  <% if n['hostgroups'].include?("private") -%>
  # Disable active host checks if in role "private"
  active_checks_enabled 0
  <% end -%>
  <% if n.has_key?("contact_groups") -%>
  contact_groups <%= n['contact_groups'].join(",") %>
  <% end -%>
 
}
<% end -%>
<% end -%>
{'fraction_non_alphanumeric': 0.23193040808494308, 'fraction_numerical': 0.002558526288857618, 'mean_word_length': 4.482468443197756, 'pattern_counts': {'":': 0, '<': 124, '<?xml version=': 0, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5193722', 'n_tokens_mistral': 2925, 'n_tokens_neox': 2763, 'n_words': 619}