Invoking the APM Java Agent While Starting your Oracle WebLogic Server

There are three ways to invoke the APM Java agent when your Oracle WebLogic server starts up.
  • Modifying startWebLogic.sh: This will start APM Agent on startup of the domain’s Oracle WebLogic administration server.

  • Modifying startManagedWebLogic.sh: This will start APM Agent on startup of the Oracle WebLogic managed servers on the domain.

  • Using the administration console: If you are using Node Manager, use the Oracle WebLogic Server administration console to configure the servers you want to add the APM Agent to.

To invoke APM Agent on the domain’s Oracle WebLogic administration server by modifying the startWebLogic.sh script of your Oracle WebLogic Server domain:
  1. Make a copy of your startWebLogic.sh file:
    % cd $DOMAIN_HOME/bin
    % cp startWebLogic.sh startWebLogic.sh.orig
  2. Using a text editor, edit the original script to add the -javaagent option to the set of Java options:
    1. Add the following line after the setDomainEnv.sh call:
      JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
      Here is an example of the startWebLogic.sh file with the above -javaagent option added.
      DOMAIN_HOME=<path to your domain home>
      . ${DOMAIN_HOME}/bin/setDomainEnv.sh $*
      JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
      JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.util.logging.manager=oracle.core.ojdl.logging.ODLLogManager"
      SAVE_JAVA_OPTIONS="${JAVA_OPTIONS}"
      SAVE_CLASSPATH="${CLASSPATH}"
  3. Restart the Oracle WebLogic Server:
    % cd $DOMAIN_HOME/bin                      
    % ./stopWebLogic.sh                        
    % cd ..                                    
    % nohup ./startWebLogic.sh >& startup.log &

    You can check the entries present in the $DOMAIN_HOME/startup.log file to verify that the Oracle WebLogic Server has started.

    Note:

    Note that the $DOMAIN_HOME version of the startWebLogic.sh is used, even though you edited the $DOMAIN_HOME/bin version. Invoking the startWebLogic.sh script from one level higher (from $DOMAIN_HOME) invokes the script from a lower level (from $DOMAIN_HOME/bin).

    However, the stopWebLogic.sh script will be called from the $DOMAIN_HOME/bin directory.

  4. If you have any managed Oracle WebLogic application servers, restart them.
To invoke APM Agent on the Oracle WebLogic managed servers by modifying the startManagedWebLogic.sh script of your Oracle WebLogic Server domain:

You can choose to monitor only the managed servers through Oracle Application Performance Monitoring, without monitoring the administration server. In such a case, make the modifications listed above in the bin/startManagedWebLogic.sh file instead of bin/startWebLogic.sh file.

  1. Make a copy of your startManagedWebLogic.sh file:

    % cd $DOMAIN_HOME/bin
    % cp startManagedWebLogic.sh startManagedWebLogic.sh.orig
  2. Using a text editor, edit the file startManagedWebLogic.sh, and locate the DOMAIN_HOME definition in the file:

    DOMAIN_HOME=<path_to_domain_home>
  3. Add the below JAVA_OPTIONS line right after the DOMAIN_HOME definition:

    DOMAIN_HOME=<path to your domain home>
    JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
  4. Restart the Oracle WebLogic Server.

To invoke APM Agent using the administration console:

If your servers are started using the Node Manager, specify the -javaagent parameter in the management console: Environment/Servers/Configuration/Server Start, in the Argument field.