<commit_before>
# Configure Monitoring Objects

    module.exports = (service) ->
      options = service.options

## Credentials

"credentials" object contains credentials for components that use authentication.
If a credential is disabled, tests that need this credential will be disabled.

      options.credentials ?= {}
      options.credentials.knox_user ?= {}
      options.credentials.knox_user.enabled ?= true
      if options.credentials.knox_user.enabled
        options.credentials.knox_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.knox_user.password' unless options.credentials.knox_user.password?
      options.credentials.sql_user ?= {}
      options.credentials.sql_user.enabled ?= true
      if options.credentials.sql_user.enabled
        options.credentials.sql_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.sql_user.password' unless options.credentials.sql_user.password?
      options.credentials.swarm_user ?= {}
      options.credentials.swarm_user.enabled ?= true
      if options.credentials.swarm_user.enabled
        options.credentials.swarm_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.password' unless options.credentials.swarm_user.password
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.cert' unless options.credentials.swarm_user.cert
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.key' unless options.credentials.swarm_user.key

## Default Configuration

Default "monitoring object" (servicegroups, hosts, etc) configuration.

      options.hostgroups ?= {}
      options.hosts ?= {}
      options.servicegroups ?= {}
      options.services ?= {}
      options.commands ?= {}
      options.realms ?= {}
      options.realms.All ?= {}
      options.clusters ?= {}
      options.contactgroups ?= {}
      options.contacts ?= {}
      options.dependencies ?= {}
      options.escalations ?= {}
      options.hostescalations ?= {}
      options.serviceescalations ?= {}
      options.timeperiods ?= {}
      # Hostgroups
      options.hostgroups['by_roles'] ?= {}
      options.hostgroups['by_roles'].alias ?= 'Role View'
      options.hostgroups['by_roles'].hostgroup_members ?= []
      options.hostgroups['by_topology'] ?= {}
      options.hostgroups['by_topology'].alias ?= 'Topological View'
      options.hostgroups['by_topology'].hostgroup_members ?= []
      options.hostgroups['watcher'] ?= {}
      options.hostgroups['watcher'].alias ?= 'Cluster Watchers'
      options.hostgroups['watcher'].hostgroup_members ?= []

### Templates

Templates are generic (abstract) objects that can define commons properties by heritage.
They must have register set to 0 to not be instanciated

      # Hosts
      options.hosts['generic-host'] ?= {}
      options.hosts['generic-host'].use ?= ''
      options.hosts['generic-host'].check_command ?= 'check_host'
      options.hosts['generic-host'].max_check_attempts ?= '2'
      options.hosts['generic-host'].check_interval ?= '300'
      options.hosts['generic-host'].retry_interval ?= '60'
      options.hosts['generic-host'].active_checks_enabled ?= '1'
      options.hosts['generic-host'].check_period ?= 'everytime'
      options.hosts['generic-host'].event_handler_enabled ?= '0'
      options.hosts['generic-host'].flap_detection_enabled ?= '1'
      options.hosts['generic-host'].process_perf_data ?= '1'
      options.hosts['generic-host'].retain_status_information ?= '1'
      options.hosts['generic-host'].retain_nonstatus_information ?= '1'
      options.hosts['generic-host'].contactgroups ?= ['admins']
      options.hosts['generic-host'].notification_interval ?= '3600'
      options.hosts['generic-host'].notification_period ?= 'everytime'
      options.hosts['generic-host'].notification_options ?= 'd,u,r,f'
      options.hosts['generic-host'].notification_enabled ?= '1'
      options.hosts['generic-host'].register = '0' # IT'S A TEMPLATE !
      options.hosts['linux-server'] ?= {}
      options.hosts['linux-server'].use ?= 'generic-host'
      options.hosts['linux-server'].check_interval ?= '60'
      options.hosts['linux-server'].retry_interval ?= '20'
      options.hosts['linux-server'].register = '0' # IT'S A TEMPLATE !
      options.hosts['aggregates'] ?= {}
      options.hosts['aggregates'].use ?= 'generic-host'
      options.hosts['aggregates'].check_command ?= 'ok'
      options.hosts['aggregates'].register = '0' # IT'S A TEMPLATE !
      # Services
      options.services['generic-service'] ?= {}
      options.services['generic-service'].use ?= ''
      options.services['generic-service'].active_checks_enabled ?= '1'
      options.services['generic-service'].passive_checks_enabled ?= '1'
      options.services['generic-service'].parallelize_check ?= '1'
      options.services['generic-service'].obsess_over_service ?= '1'
      options.services['generic-service'].check_freshness ?= '1'
      options.services['generic-service'].first_notification_delay ?= '0'
      options.services['generic-service'].freshness_threshold ?= '3600'
      options.services['generic-service'].notifications_enabled ?= '1'
      options.services['generic-service'].flap_detection_enabled ?= '0'
      options.services['generic-service'].failure_prediction_enabled ?= '1'
      options.services['generic-service'].process_perf_data ?= '1'
      options.services['generic-service'].retain_status_information ?= '1'
      options.services['generic-service'].retain_nonstatus_information ?= '1'
      options.services['generic-service'].is_volatile ?= '0'
      options.services['generic-service'].check_period ?= 'everytime'
      options.services['generic-service'].max_check_attempts ?= '3'
      options.services['generic-service'].check_interval ?= '300'
      options.services['generic-service'].retry_interval ?= '60'
      options.services['generic-service'].contactgroups ?= 'admins'
      options.services['generic-service'].notifications_options ?= 'w,u,c,r'
      options.services['generic-service'].notification_interval ?= '3600'
      options.services['generic-service'].notification_period ?= 'everytime'
      options.services['generic-service'].business_rule_output_template ?= '$($HOSTNAME$: $SERVICEDESC$)$'
      options.services['generic-service'].register = '0'
      options.services['unit-service'] ?= {}
      options.services['unit-service'].use ?= 'generic-service'
      options.services['unit-service'].register = '0'
      options.services['unit-service'].check_interval = '30'
      options.services['unit-service'].retry_interval = '10'
      options.services['bp-service'] ?= {}
      options.services['bp-service'].use ?= 'unit-service'
      options.services['bp-service'].register ?= '0'
      options.services['process-service'] ?= {}
      options.services['process-service'].use ?= 'unit-service'
      options.services['process-service'].register = '0'
      options.services['cert-service'] ?= {}
      options.services['cert-service'].use ?= 'unit-service'
      options.services['cert-service'].check_interval = '1800'
      options.services['cert-service'].register ?= '0'
      options.services['functional-service'] ?= {}
      options.services['functional-service'].use ?= 'generic-service'
      options.services['functional-service'].check_interval = '600'
      options.services['functional-service'].retry_interval = '30'
      options.services['functional-service'].register = '0'
      # ContactGroups
      options.contactgroups['admins'] ?= {}
      options.contactgroups['admins'].alias ?= 'Administrators'
      # Contacts
      options.contacts['generic-contact'] ?= {}
      options.contacts['generic-contact'].use ?= ''
      options.contacts['generic-contact'].service_notification_period ?= 'everytime'
      options.contacts['generic-contact'].host_notification_period ?= 'everytime'
      options.contacts['generic-contact'].service_notification_options ?= 'w,u,c,r,f'
      options.contacts['generic-contact'].host_notification_options ?= 'd,u,r,f,s'
      options.contacts['generic-contact'].service_notification_commands ?= 'notify-service-by-email'
      options.contacts['generic-contact'].host_notification_commands ?= 'notify-host-by-email'
      options.contacts['generic-contact'].host_notifications_enabled ?= '1'
      options.contacts['generic-contact'].service_notifications_enabled ?= '1'
      options.contacts['generic-contact'].can_submit_commands ?= '0'
      options.contacts['generic-contact'].register = '0'
      options.contacts['admin-contact'] ?= {}
      options.contacts['admin-contact'].use ?= 'generic-contact'
      options.contacts['admin-contact'].can_submit_commands ?= '1'
      options.contacts['admin-contact'].is_admin ?= '1'
      options.contacts['admin-contact'].contactgroups ?= ['admins']
      options.contacts['admin-contact'].register = '0'
      options.contacts['admin'] ?= {}
      options.contacts['admin'].use ?= 'admin-contact'
      options.contacts['admin'].register ?= '1'
      unless options.contacts['admin'].password or "#{options.contacts['admin'].register}" is '0'
        throw Error "Missing property: ryba.monitoring.contacts.admin.password"
      options.contacts['readonly-contact'] ?= {}
      options.contacts['readonly-contact'].use ?= 'generic-contact'
      options.contacts['readonly-contact'].alias ?= 'Read-Only Users'
      options.contacts['readonly-contact'].contactgroups ?= ['readonly']<commit_msg>monitoring: add missing service groups<commit_after>
# Configure Monitoring Objects

    module.exports = (service) ->
      options = service.options

## Credentials

"credentials" object contains credentials for components that use authentication.
If a credential is disabled, tests that need this credential will be disabled.

      options.credentials ?= {}
      options.credentials.knox_user ?= {}
      options.credentials.knox_user.enabled ?= true
      if options.credentials.knox_user.enabled
        options.credentials.knox_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.knox_user.password' unless options.credentials.knox_user.password?
      options.credentials.sql_user ?= {}
      options.credentials.sql_user.enabled ?= true
      if options.credentials.sql_user.enabled
        options.credentials.sql_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.sql_user.password' unless options.credentials.sql_user.password?
      options.credentials.swarm_user ?= {}
      options.credentials.swarm_user.enabled ?= true
      if options.credentials.swarm_user.enabled
        options.credentials.swarm_user.username ?= 'ryba'
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.password' unless options.credentials.swarm_user.password
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.cert' unless options.credentials.swarm_user.cert
        throw Error 'Required property: ryba.monitoring.credentials.swarm_user.key' unless options.credentials.swarm_user.key

## Default Configuration

Default "monitoring object" (servicegroups, hosts, etc) configuration.

      options.hostgroups ?= {}
      options.hosts ?= {}
      options.servicegroups ?= {}
      options.services ?= {}
      options.commands ?= {}
      options.realms ?= {}
      options.realms.All ?= {}
      options.clusters ?= {}
      options.contactgroups ?= {}
      options.contacts ?= {}
      options.dependencies ?= {}
      options.escalations ?= {}
      options.hostescalations ?= {}
      options.serviceescalations ?= {}
      options.timeperiods ?= {}
      # Hostgroups
      options.hostgroups['by_roles'] ?= {}
      options.hostgroups['by_roles'].alias ?= 'Role View'
      options.hostgroups['by_roles'].hostgroup_members ?= []
      options.hostgroups['by_topology'] ?= {}
      options.hostgroups['by_topology'].alias ?= 'Topological View'
      options.hostgroups['by_topology'].hostgroup_members ?= []
      options.hostgroups['watcher'] ?= {}
      options.hostgroups['watcher'].alias ?= 'Cluster Watchers'
      options.hostgroups['watcher'].hostgroup_members ?= []

### Templates

Templates are generic (abstract) objects that can define commons properties by heritage.
They must have register set to 0 to not be instanciated

      # Hosts
      options.hosts['generic-host'] ?= {}
      options.hosts['generic-host'].use ?= ''
      options.hosts['generic-host'].check_command ?= 'check_host'
      options.hosts['generic-host'].max_check_attempts ?= '2'
      options.hosts['generic-host'].check_interval ?= '300'
      options.hosts['generic-host'].retry_interval ?= '60'
      options.hosts['generic-host'].active_checks_enabled ?= '1'
      options.hosts['generic-host'].check_period ?= 'everytime'
      options.hosts['generic-host'].event_handler_enabled ?= '0'
      options.hosts['generic-host'].flap_detection_enabled ?= '1'
      options.hosts['generic-host'].process_perf_data ?= '1'
      options.hosts['generic-host'].retain_status_information ?= '1'
      options.hosts['generic-host'].retain_nonstatus_information ?= '1'
      options.hosts['generic-host'].contactgroups ?= ['admins']
      options.hosts['generic-host'].notification_interval ?= '3600'
      options.hosts['generic-host'].notification_period ?= 'everytime'
      options.hosts['generic-host'].notification_options ?= 'd,u,r,f'
      options.hosts['generic-host'].notification_enabled ?= '1'
      options.hosts['generic-host'].register = '0' # IT'S A TEMPLATE !
      options.hosts['linux-server'] ?= {}
      options.hosts['linux-server'].use ?= 'generic-host'
      options.hosts['linux-server'].check_interval ?= '60'
      options.hosts['linux-server'].retry_interval ?= '20'
      options.hosts['linux-server'].register = '0' # IT'S A TEMPLATE !
      options.hosts['aggregates'] ?= {}
      options.hosts['aggregates'].use ?= 'generic-host'
      options.hosts['aggregates'].check_command ?= 'ok'
      options.hosts['aggregates'].register = '0' # IT'S A TEMPLATE !
      # Services
      options.services['generic-service'] ?= {}
      options.services['generic-service'].use ?= ''
      options.services['generic-service'].active_checks_enabled ?= '1'
      options.services['generic-service'].passive_checks_enabled ?= '1'
      options.services['generic-service'].parallelize_check ?= '1'
      options.services['generic-service'].obsess_over_service ?= '1'
      options.services['generic-service'].check_freshness ?= '1'
      options.services['generic-service'].first_notification_delay ?= '0'
      options.services['generic-service'].freshness_threshold ?= '3600'
      options.services['generic-service'].notifications_enabled ?= '1'
      options.services['generic-service'].flap_detection_enabled ?= '0'
      options.services['generic-service'].failure_prediction_enabled ?= '1'
      options.services['generic-service'].process_perf_data ?= '1'
      options.services['generic-service'].retain_status_information ?= '1'
      options.services['generic-service'].retain_nonstatus_information ?= '1'
      options.services['generic-service'].is_volatile ?= '0'
      options.services['generic-service'].check_period ?= 'everytime'
      options.services['generic-service'].max_check_attempts ?= '3'
      options.services['generic-service'].check_interval ?= '300'
      options.services['generic-service'].retry_interval ?= '60'
      options.services['generic-service'].contactgroups ?= 'admins'
      options.services['generic-service'].notifications_options ?= 'w,u,c,r'
      options.services['generic-service'].notification_interval ?= '3600'
      options.services['generic-service'].notification_period ?= 'everytime'
      options.services['generic-service'].business_rule_output_template ?= '$($HOSTNAME$: $SERVICEDESC$)$'
      options.services['generic-service'].register = '0'
      options.services['unit-service'] ?= {}
      options.services['unit-service'].use ?= 'generic-service'
      options.services['unit-service'].register = '0'
      options.services['unit-service'].check_interval = '30'
      options.services['unit-service'].retry_interval = '10'
      options.services['bp-service'] ?= {}
      options.services['bp-service'].use ?= 'unit-service'
      options.services['bp-service'].register ?= '0'
      options.services['process-service'] ?= {}
      options.services['process-service'].use ?= 'unit-service'
      options.services['process-service'].register = '0'
      options.services['cert-service'] ?= {}
      options.services['cert-service'].use ?= 'unit-service'
      options.services['cert-service'].check_interval = '1800'
      options.services['cert-service'].register ?= '0'
      options.services['functional-service'] ?= {}
      options.services['functional-service'].use ?= 'generic-service'
      options.services['functional-service'].check_interval = '600'
      options.services['functional-service'].retry_interval = '30'
      options.services['functional-service'].register = '0'
      for k in Object.keys options.clusters
        options.services["process-service-#{k}"] ?= {}
        options.services["process-service-#{k}"].use ?= 'unit-service'
        options.services["process-service-#{k}"].register ?= '0'
      # ContactGroups
      options.contactgroups['admins'] ?= {}
      options.contactgroups['admins'].alias ?= 'Administrators'
      # Contacts
      options.contacts['generic-contact'] ?= {}
      options.contacts['generic-contact'].use ?= ''
      options.contacts['generic-contact'].service_notification_period ?= 'everytime'
      options.contacts['generic-contact'].host_notification_period ?= 'everytime'
      options.contacts['generic-contact'].service_notification_options ?= 'w,u,c,r,f'
      options.contacts['generic-contact'].host_notification_options ?= 'd,u,r,f,s'
      options.contacts['generic-contact'].service_notification_commands ?= 'notify-service-by-email'
      options.contacts['generic-contact'].host_notification_commands ?= 'notify-host-by-email'
      options.contacts['generic-contact'].host_notifications_enabled ?= '1'
      options.contacts['generic-contact'].service_notifications_enabled ?= '1'
      options.contacts['generic-contact'].can_submit_commands ?= '0'
      options.contacts['generic-contact'].register = '0'
      options.contacts['admin-contact'] ?= {}
      options.contacts['admin-contact'].use ?= 'generic-contact'
      options.contacts['admin-contact'].can_submit_commands ?= '1'
      options.contacts['admin-contact'].is_admin ?= '1'
      options.contacts['admin-contact'].contactgroups ?= ['admins']
      options.contacts['admin-contact'].register = '0'
      options.contacts['admin'] ?= {}
      options.contacts['admin'].use ?= 'admin-contact'
      options.contacts['admin'].register ?= '1'
      unless options.contacts['admin'].password or "#{options.contacts['admin'].register}" is '0'
        throw Error "Missing property: ryba.monitoring.contacts.admin.password"
      options.contacts['readonly-contact'] ?= {}
      options.contacts['readonly-contact'].use ?= 'generic-contact'
      options.contacts['readonly-contact'].alias ?= 'Read-Only Users'
      options.contacts['readonly-contact'].contactgroups ?= ['readonly']
{'fraction_non_alphanumeric': 0.15498193082085698, 'fraction_numerical': 0.008311822405782137, 'mean_word_length': 3.9963889605364975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5885114', 'n_tokens_mistral': 5756, 'n_tokens_neox': 5588, 'n_words': 739}