You can configure the Java Agent for those JVMs that run as cron or batch jobs where the JVM runs only for the duration of the job. 

Configure the Java Agent

  1. Add the application and tier name to the controller-info.xml file.
  2. Add the appdynamics.cron.vm property to the AppDynamics javaagent command in the startup script of your JVM process:

    -javaagent:<agent_home>/javaagent.jar -Dappdynamics.agent.nodeName=${NODE_NAME} -Dappdynamics.cron.vm=true
    CODE

The appdynamics.cron.vm property creates a delay between the end of the main method and the JVM exit so that the Agent has time to upload metrics to the Controller.

Use the Script Name as the Node Name

You can use the name of the script that executes a cron or batch job in the node name. These commands set the value of variable NODE_NAME using the combination of the script and hostname. Add these commands to the startup script of the JVM.

# Use the name of the script (no path, no extension) as the name of the node.
NODE_NAME=sample
NODE_NAME="${NODE_NAME%%.}"
echo $NODE_NAME
# Localize the script to the host.
NODE_NAME="$NODE_NAME@$HOSTNAME"
CODE