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

# monitoring service checks
define service {
    service_description Nagios
    hostgroup_name      <%= node['nagios']['server_role'] %>
    check_command       check-nagios
    contact_groups      admins
    use                 default-service
}

# Services defined by data bags
<% @services.each do |service| -%>
  <%# Do not define a service that has no hostgroup or a hostgroup that doesn't exist (including the "all" hostgroup) %>
  <% unless service['hostgroup_name'].nil? || !(@hostgroups.include?(service['hostgroup_name']) || @search_hostgroups.include?(service['hostgroup_name']) || service['hostgroup_name'] == "all") -%>
define service {
  service_description <%= service['description'] || service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
  <% if service['use_existing_command'] -%>
  check_command <%= service['use_existing_command'] %>
  <% else -%>
  check_command check_<%= service['id'] %>
  <% end -%>
  use <% if service['service_template'].nil? -%>default-service<% else -%><%= service['service_template'] %> <% end -%>
  <% unless service['event_handler'].nil? -%>event_handler <%= service['event_handler'] %><% end -%>
  <% %w{check_interval retry_interval notification_interval}.each do |conf| %>
    <% unless service[conf].nil? %>
  <%= conf %> <%= nagios_interval(service[conf]) %>
    <% end %>
  <% end %>
  <% %w{passive_checks_enabled parallelize_check obsess_over_service check_freshness notifications_enabled event_handler_enabled flap_detection_enabled failure_prediction_enabled process_perf_data retain_status_information retain_nonstatus_information is_volatile check_period max_check_attempts contacts contact_groups notification_options notification_period notes_url action_url servicegroups}.each do |conf| %>
    <% unless service[conf].nil? %>
  <%= conf %> <%= service[conf] %>
    <% end %>
  <% end %>
}
<% if service['use_escalation'] %>define serviceescalation {
  # this should be an escalation defined in the nagios_serviceescalation data bag
  use <%= service['use_escalation'] %>
  service_description <%= service['description'] || service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
}
<% end %>
  <% end -%>
<% end -%>
<commit_msg>support optional environment attribute in services to filter services by environment<commit_after># Service definitions
#
# Autogenerated by Chef.

# monitoring service checks
define service {
    service_description Nagios
    hostgroup_name      <%= node['nagios']['server_role'] %>
    check_command       check-nagios
    contact_groups      admins
    use                 default-service
}

# Services defined by data bags
<% @services.each do |service| -%>
  <%# Do not define a service that has no hostgroup or a hostgroup that doesn't exist (including the "all" hostgroup) %>
  <% unless service['hostgroup_name'].nil? || !(@hostgroups.include?(service['hostgroup_name']) || @search_hostgroups.include?(service['hostgroup_name']) || service['hostgroup_name'] == "all") || (service['environment'] && service['environment'] != node.chef_environment ) -%>
define service {
  service_description <%= service['description'] || service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
  <% if service['use_existing_command'] -%>
  check_command <%= service['use_existing_command'] %>
  <% else -%>
  check_command check_<%= service['id'] %>
  <% end -%>
  use <% if service['service_template'].nil? -%>default-service<% else -%><%= service['service_template'] %> <% end -%>
  <% unless service['event_handler'].nil? -%>event_handler <%= service['event_handler'] %><% end -%>
  <% %w{check_interval retry_interval notification_interval}.each do |conf| %>
    <% unless service[conf].nil? %>
  <%= conf %> <%= nagios_interval(service[conf]) %>
    <% end %>
  <% end %>
  <% %w{passive_checks_enabled parallelize_check obsess_over_service check_freshness notifications_enabled event_handler_enabled flap_detection_enabled failure_prediction_enabled process_perf_data retain_status_information retain_nonstatus_information is_volatile check_period max_check_attempts contacts contact_groups notification_options notification_period notes_url action_url servicegroups}.each do |conf| %>
    <% unless service[conf].nil? %>
  <%= conf %> <%= service[conf] %>
    <% end %>
  <% end %>
}
<% if service['use_escalation'] %>define serviceescalation {
  # this should be an escalation defined in the nagios_serviceescalation data bag
  use <%= service['use_escalation'] %>
  service_description <%= service['description'] || service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
}
<% end %>
  <% end -%>
<% end -%>

{'fraction_non_alphanumeric': 0.1504988325196349, 'fraction_numerical': 0.0, 'mean_word_length': 5.191852825229961, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 77, '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': '1538779', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1351, 'n_words': 307}