jardatadogprocess-monitoring

DataDog agent cannot find JAR process with matching name


I have configured DD agent on AWS Ubuntu machine and defined CPU Usage, RAM monitors, and metric is correctly reflecting in the dashboard.

Inside /etc/dd-agent/conf.d in file process.yaml:

init_config:

instances:
  - name: ecommerce-order
    search_string: ['ecommerce-order']
    tags:
      - env:dev

On the same machine, I have a JAR running as a process with name ecommerce-order-0.0.1-SNAPSHOT.jar as a process.

When I do:

ps -ef | grep ecommerce-order

I get:

root  350  1  0 Oct12 ?  00:13:29 java -Xmx100m -Xms50m -XX:+UseG1GC 
  -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=45 -jar 
  -Dspring.profiles.active=dev ./ecommerce-order-0.0.1-SNAPSHOT.jar

But when I do:

sudo /etc/init.d/datadog-agent info

I get:

Checks
======
process (5.18.0)
----------------
  - instance #0 [WARNING]
      Warning: No matching process 'ecommerce-order' was found
  - Collected 1 metric, 0 events & 1 service check

I want a process monitor who can check if a JAR with some name is currently running or not. What is it I am doing wrong?


Solution

  • I think what you want is to add the "exact_match: false" option, like so:

    init_config:
    
    instances:
      - name: ecommerce-order
        search_string: ['ecommerce-order']
        exact_match: False
        tags:
          - env:dev
    

    This should match on any process whose path+name include the search string you provide.

    Alternatively, if you only want it to match on the name of the process, you'll want to set the search_string to be the exact name of the process that's running (so whatever is given as the name when you run a ps | grep "ecommerce-order", which in your case seems to be ecommerce-order-0.0.1-SNAPSHOT.jar)