Sunday, May 05, 2019

Datadog- Artifactory JMX Monitoring

Datadog JMX integration collects metrics from applications that expose JMX metrics. A lightweight Java plugin named "JMXFetch" is called by the Datadog Agent to connect to the MBean server and to collect metrics, it can also send service checks that report on the status of your monitored instances.

This plugin sends metrics to the Datadog Agent using DogStatsD server running within the Agent. In the blog we will show you how to collect and send metrics from Artifactory application.

Prerequisites:

  1. You have a running Artifactory application with JMX enabled (https://jfrog.com/knowledge-base/how-do-i-use-jmx-remote-monitoring/)
  2. You have a running Datadog agent which has access to your Artifactory JMX port

Configuration:

You need to enable JMX monitoring in Datadog by creating a file "/etc/datadog-agent/conf.d/jmx.d/conf.yaml" with the following configuration:

init_config:
  new_gc_metrics: true

instances:
  - host: localhost # If DD agent is running on the same host
    port: 9010
    user: <USER_NAME>
    password: <PASSWORD>
    name: artifactory-app
    
    tags:
      env: pord
    
    conf:
      - include:
        domain: org.jfrog.artifactory
        bean:
          - org.jfrog.artifactory:instance=Artifactory, type=Storage,prop=Binary Storage
          - org.jfrog.artifactory:instance=Artifactory, type=Repositories,prop=test-repo
        attribute:
          # Ginary storage size
          - Size
          # Repo
          - ArtifactsTotalSize
          - ArtifactsCount

      - include:
        domain: Catalina
        bean:
          - Catalina:type=ThreadPool,name="http-nio-8081"
        attribute:
          - maxThreads
          - currentThreadCount
          - currentThreadBusy
   

This following graph shows you a visual mapping between Mbeans and the actual Datadog configuration.


You can also use the new way of MBean configuration, as described following (https://docs.datadoghq.com/integrations/java/):

  conf:
    - include:
        domain: org.apache.cassandra.db
        attribute:
          - BloomFilterDiskSpaceUsed
          - BloomFilterFalsePositives
          - BloomFilterFalseRatio
          - Capacity
          - CompressionRatio
          - CompletedTasks
          - ExceptionCount
          - Hits
          - RecentHitRate
   

But I couldn't get the new confiuration to work as the old one yet, the new one looks much easier to config, but it didn't work for me, for some reason it is not sending metrics to Datadog platform.

You could use "datadog-agent jmx list collected" command to check what JMX metrics that you are collecting.

Note1:

To run more than one JMX check, create configuration files with the format jmx_<INDEX>.d/conf.yaml (e.g. jmx_1.d/conf.yaml, jmx_2.d/conf.yaml, etc). Each folder should be stored in the conf.d directory. Include the is_jmx option set to true in those configuration files.

The 350 metric limit

Due to the nature of these integrations, it is possible to submit an extremely high number of metrics directly to Datadog. Many customers agree that some of these metrics are not needed. Therefore, Datadog has set the limit at 350 metrics.

No comments: