<commit_before># Nagios Service Definitions.
#
# Automatically generated by Chef.

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

# default checks for all hosts

define service {
    service_description Chef Client
    hostgroup_name     linux
    check_command      check_chef_client
    use                default-service
}

define service {
    service_description Free Space All Disks
    hostgroup_name      linux
    check_command       check_all_disks
    use                 default-service
}

define service {
    service_description SSH
    hostgroup_name      linux
    check_command       check_ssh
    use                 default-service
}

<% unless @service_hosts['monitoring'].nil? -%>
# If the monitoring host is a postfix relay, uncomment this.
#define service {
#    service_description Postfix
#    hostgroup_name      monitoring
#    check_command       check_nrpe!check_smtp
#    use                 default-service
#}

# If the monitoring host is a syslog server, uncomment this.
#define service {
#    service_description Rsyslog
#    hostgroup_name      monitoring
#    check_command       check_tcp!514
#    use                 default-service
#}

<% end -%>
<% unless @service_hosts['webserver'].nil? -%>
# basic web server http check
define service {
    service_description HTTP Processes
    hostgroup_name      webserver
    check_command       check_http
    use                 default-service
}

<% end -%>
<% unless @service_hosts['appserver'].nil? -%>
# basic check if appserver role is running unicorn
define service {
    service_description Unicorn Processes
    hostgroup_name      appserver
    check_command       check_nrpe!check_unicorn
    use                 default-service
}

define service {
    service_description Unicorn HTTP
    hostgroup_name      appserver
    check_command       check_http_port_expect!8080!"HTTP/1.1 302 Found"
    use                 default-service
}

<% end -%>
<% unless @service_hosts['database_master'].nil? -%>
# basic check if the database_master role is a mysql server
# database_master service checks
define service {
    service_description MySQL
    hostgroup_name      database_master
    check_command       check_nrpe!check_mysql_server
    use                 default-service
}

<% end -%>

# Services defined by data bags
<% @services.each do |service| -%>
  <% unless @service_hosts[service['hostgroup_name'].nil? && service['hostgroup_name'] != 'all' ] -%>
define service {
  service_description <%= service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
  check_command check_<%= service['id'] %>
  use default-service
  <% if service['event_handler'].exists? -%>
  event_handler <%= service['event_handler'] %>
  <% end -%>
}
  <% end -%>
<% end -%><commit_msg>Change to .nil when checking for the existence of a variable<commit_after># Nagios Service Definitions.
#
# Automatically generated by Chef.

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

# default checks for all hosts

define service {
    service_description Chef Client
    hostgroup_name     linux
    check_command      check_chef_client
    use                default-service
}

define service {
    service_description Free Space All Disks
    hostgroup_name      linux
    check_command       check_all_disks
    use                 default-service
}

define service {
    service_description SSH
    hostgroup_name      linux
    check_command       check_ssh
    use                 default-service
}

<% unless @service_hosts['monitoring'].nil? -%>
# If the monitoring host is a postfix relay, uncomment this.
#define service {
#    service_description Postfix
#    hostgroup_name      monitoring
#    check_command       check_nrpe!check_smtp
#    use                 default-service
#}

# If the monitoring host is a syslog server, uncomment this.
#define service {
#    service_description Rsyslog
#    hostgroup_name      monitoring
#    check_command       check_tcp!514
#    use                 default-service
#}

<% end -%>
<% unless @service_hosts['webserver'].nil? -%>
# basic web server http check
define service {
    service_description HTTP Processes
    hostgroup_name      webserver
    check_command       check_http
    use                 default-service
}

<% end -%>
<% unless @service_hosts['appserver'].nil? -%>
# basic check if appserver role is running unicorn
define service {
    service_description Unicorn Processes
    hostgroup_name      appserver
    check_command       check_nrpe!check_unicorn
    use                 default-service
}

define service {
    service_description Unicorn HTTP
    hostgroup_name      appserver
    check_command       check_http_port_expect!8080!"HTTP/1.1 302 Found"
    use                 default-service
}

<% end -%>
<% unless @service_hosts['database_master'].nil? -%>
# basic check if the database_master role is a mysql server
# database_master service checks
define service {
    service_description MySQL
    hostgroup_name      database_master
    check_command       check_nrpe!check_mysql_server
    use                 default-service
}

<% end -%>

# Services defined by data bags
<% @services.each do |service| -%>
  <% unless @service_hosts[service['hostgroup_name'].nil? && service['hostgroup_name'] != 'all' ] -%>
define service {
  service_description <%= service['id'] %>
  hostgroup_name <%= service['hostgroup_name'] %>
  check_command check_<%= service['id'] %>
  use default-service
  <% if service['event_handler'].nil? -%>
  event_handler <%= service['event_handler'] %>
  <% end -%>
}
  <% end -%>
<% end -%>
{'fraction_non_alphanumeric': 0.08564189189189189, 'fraction_numerical': 0.004054054054054054, 'mean_word_length': 2.7569796954314723, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, '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': '5557738', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1642, 'n_words': 436}