#TODO: why not into the tomcat.yml? Conditional existence of servers
instances:

<% node['datadog']['tomcat']['instances'].each do |instanceName,props| -%>
  <% if props['enabled'] -%>
    -  host: <%= props['jmx_hostname'] %>
       port: <%= props['port'] %>
       user: <%= props['jmx_username'] %>
       password: <%= props['jmx_password'] %>
       java_options: <%= props['java_options'] %>
       name: <%= instanceName %>
  <% end -%>
<% end -%>


init_config:
  conf:
  - include:
      bean: jets3t:Type=S3ServiceException
      attribute:
        AccessDenied:
          alias: S3Service.Exception.AccessDenied
          metric_type: gauge
        InternalError:
          alias: S3Service.Exception.InternalError
          metric_type: gauge
        RequestTimeout:
          alias: S3Service.Exception.RequestTimeout
          metric_type: gauge
        ServiceUnavailable:
          alias: S3Service.Exception.ServiceUnavailable
          metric_type: gauge
        SlowDown:
          alias: S3Service.Exception.SlowDown
          metric_type: gauge
  - include:
      bean: Alfresco:CachingContentStores,BeanName=cachingContentStore,Component=QuotaManager
      attribute:
        CurrentUsageMB:
          alias: Alfresco.cachingContentStore.CurrentUsageMB
          metric_type: gauge
  - include:
      bean: Alfresco:Name=CloudSync
      attribute:
        AveragePullRequestTime:
          alias: CloudSync.AveragePullRequestTime
          metric_type: gauge
        AveragePushRequestTime:
          alias: CloudSync.AveragePushRequestTime
          metric_type: gauge
        PullRequestFailureCount:
          alias: CloudSync.PullRequestFailureCount
          metric_type: counter
        PushRequestFailureCount:
          alias: CloudSync.PushRequestFailureCount
          metric_type: counter
        TotalPullRequestCount:
          alias: CloudSync.TotalPullRequestCount
          metric_type: gauge
        TotalPushRequestCount:
          alias: CloudSync.TotalPushRequestCount
          metric_type: gauge
  - include:
      bean: Alfresco:Name=Cluster,Tool=Admin
      attribute:
        NumClusterMembers:
          alias: Alfresco.cluster.MemberCount
          metric_type: gauge
  - include:
      bean: Alfresco:Name=ConnectionPool
      attribute:
        NumActive:
          alias: Alfresco.ConnectionPool.NumActive
          metric_type: gauge
  - include:
      bean: Alfresco:Name=Authority
      attribute:
        NumberOfUsers:
          alias: Alfresco.NumberOfUsers
          metric_type: gauge
        NumberOfGroups:
          alias: Alfresco.NumberOfGroups
          metric_type: gauge
  - include:
      bean: com.hazelcast:type=Cluster,name=_hzInstance_1_share
      attribute:
        MemberCount:
          alias: Share.cluster.MemberCount
          metric_type: gauge
