17 Uninstall APM Agent

A user with Application Performance Monitoring administrator role can uninstall the APM Agent.

Topics:

Uninstall APM Java Agent

This section discusses how you can uninstall APM Java Agents.

Remove APM Java Agents from Oracle WebLogic Server

To disable and remove APM Java Agents from a WebLogic domain, complete the following tasks:

  1. Task 1: Disable the APM Java Agent in the WebLogic Server Domain

    1. Stop the WebLogic Server:

      % cd $DOMAIN_HOME/bin
      % ./stopWebLogic.sh
    2. Remove the edited version of the startWebLogic.sh script, and replace it with the original script that was backed up before you installed the APM Java Agent:
      % mv startWebLogic.sh.orig startWebLogic.sh
    3. Restart the WebLogic Server:
      % cd $DOMAIN_HOME
      % nohup ./startWebLogic.sh >& startup.log &

      Note:

      Note that in the above script you are using the $DOMAIN_HOME version of startWebLogic.sh, even though you had earlier edited the $DOMAIN_HOME/bin version. Invoking this script from one level higher will in fact invoke the script from a lower level.

  2. Task 2: Delete the APM Java Agent Software from the WebLogic Server Domain

    1. Remove the directory where the APM Java Agent files were extracted:
      % cd $DOMAIN_HOME
      % rm -r apmagent
    2. Remove the directory where you initially extracted the APM Java Agent installation software.

  3. Task 3: Remove APM Java Agent References from Oracle Management Cloud

    1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

    2. On the APM Agents page, select the APM Java Agent that you want to remove. Use the Search feature to search for a specific APM Java Agent.

    3. On the right side of the page, click the Actions menu and select Remove.

Remove APM Java Agents from WebSphere Server

To disable and remove APM Java Agents from your WebSphere application server, complete the following tasks:

  1. Task 1: Disable the APM Java Agent in the WebSphere Server

    1. From your WebSphere Admin console, click the Servers tab and select the server on which you want to provision the APM Java Agent.

    2. Expand Java and Process Management tab and select Process Definition.

    3. Under Additional Properties tab, select Java Virtual Machine.

    4. In the Generic JVM arguments field, remove the following line:

      -javaagent:\$WAS_HOME/apmagent/lib/system/ApmAgentInstrumentation.jar -Dws.ext.dirs=\$WAS_HOME/apmagent/lib/agent/ApmEumFilter.jar

    5. Remove the edited version of the server.policy file, and replace it with the original script that was backed up before you installed the APM Java Agent:
      % mv server.policy.sh.orig server.policy.sh
    6. Restart the WebSphere Server:
      % cd $WAS_HOME/bin
      ./stopServer.sh <servername>
      ./startServer.sh <servername>
      

      Note:

      Note that in the above script you are using the $WAS_HOME version of the server.policy file, even though you had earlier edited the $WAS_HOME/bin version. Invoking this script from one level higher will in fact invoke the script from a lower level.

  2. Task 2: Delete the APM Java Agent Software from the WebSphere Server

    1. Remove the directory where the APM Java Agent files were extracted:
      % cd $WAS_HOME
      % rm -r apmagent
    2. Remove the directory where you initially extracted the APM Java Agent installation software.

  3. Task 3: Remove APM Java Agent References from Oracle Management Cloud

    1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

    2. On the APM Agents page, select the APM Java Agent that you want to remove. Use the Search feature to search for a specific APM Java Agent.

    3. On the right side of the page, click the Actions menu and select Remove.

Remove APM Java Agents from Apache Tomcat

To disable and remove APM Java Agents from your Apache Tomcat application server, complete the following tasks:

  1. Task 1: Disable the APM Java Agent in the Apache Tomcat Server

    1. Stop the Apache Tomcat Server:

      % cd $CATALINA_HOME/bin
      % ./shutdown.sh
    2. Remove the edited version of the catalina.sh file, and replace it with the original script that was backed up before you installed the APM Java Agent:
      % mv catalina.sh.orig catalina.sh
    3. Restart the Tomcat Server:
      % cd $CATALINA_HOME/bin
      % ./shutdown.sh
      % ./startup.sh

      Note:

      Note that in the above script you are using the $CATALINA_HOME version of the catalina.sh file, even though you had earlier edited the $CATALINA_HOME/bin version. Invoking this script from one level higher will in fact invoke the script from a lower level.

  2. Task 2: Delete the APM Java Agent Software from the Tomcat Server

    1. Remove the directory where the APM Java Agent files were extracted:
      % cd $CATALINA_HOME
      % rm -r apmagent
    2. Remove the directory where you initially extracted the APM Java Agent installation software.

  3. Task 3: Remove APM Java Agent References from Oracle Management Cloud

    1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

    2. On the APM Agents page, select the APM Java Agent that you want to remove. Use the Search feature to search for a specific APM Java Agent.

    3. On the right side of the page, click the Actions menu and select Remove.

Remove APM Java Agents from JBoss

To disable and remove APM Java Agents from your JBoss application server, complete the following tasks:

  1. Task 1: Disable the APM Java Agent in the JBoss Server

    1. Stop the JBoss Server:

      % cd $JBOSS_HOME/bin
      % ./jboss-cli.sh -c :shutdown
    2. Remove the edited version of the standalone.conf file, and replace it with the original script that was backed up before you installed the APM Java Agent:
      % mv standalone.conf.orig standalone.conf
    3. Restart the JBoss Server:
      % cd $JBOSS_HOME/bin
      % ./jboss-cli.sh -c :shutdown                        
      % nohup ./standalone.sh -b 0.0.0.0&> startup.log &

      Note:

      Note that in the above script you are using the $JBOSS_HOME version of the standalone.conf file, even though you had earlier edited the $JBOSS_HOME/bin version. Invoking this script from one level higher will in fact invoke the script from a lower level.

  2. Task 2: Delete the APM Java Agent Software from the Tomcat Server

    1. Remove the directory where the APM Java Agent files were extracted:
      % cd $CATALINA_HOME
      % rm -r apmagent
    2. Remove the directory where you initially extracted the APM Java Agent installation software.

  3. Task 3: Remove APM Java Agent References from Oracle Management Cloud

    1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

    2. On the APM Agents page, select the APM Java Agent that you want to remove. Use the Search feature to search for a specific APM Java Agent.

    3. On the right side of the page, click the Actions menu and select Remove.

Remove APM Java Agents from Jetty

To disable and remove APM Java Agents from your Jetty application server, complete the following tasks:

  1. Task 1: Disable the APM Java Agent in the Jetty Server

    1. Stop the Jetty Server.

      Remove the edited version of the java -jar start.jar file, and replace it with the original script that was backed up before you installed the APM Java Agent:
      % mv java -jar start.jar.orig java -jar start.jar
    2. Restart the Jetty Server.

      Note:

      Note that in the above script you are using the $JETTY_HOME version of the java -jar start.jar file, even though you had earlier edited the $JETTY_HOME/bin version. Invoking this script from one level higher will in fact invoke the script from a lower level.

  2. Task 2: Delete the APM Java Agent Software from the Jetty Server

    1. Remove the directory where the APM Java Agent files were extracted:
      % cd $JETTY_HOME
      % rm -r apmagent
    2. Remove the directory where you initially extracted the APM Java Agent installation software.

  3. Task 3: Remove APM Java Agent References from Oracle Management Cloud

    1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

    2. On the APM Agents page, select the APM Java Agent that you want to remove. Use the Search feature to search for a specific APM Java Agent.

    3. On the right side of the page, click the Actions menu and select Remove.

Uninstall APM .Net Agent

This section discusses how you can uninstall APM .Net Agents.

Remove APM .Net Agent

An administrator can remove APM .Net Agents by completing the following tasks:
  • Task 1: Remove APM .Net Agent

  • Task 2: Remove APM .NET Agent References from Oracle Management Cloud

Task 1: Remove APM .Net Agent

  1. Stop the IIS server.

    iisreset /stop
  2. You can remove APM .Net Agent in any of the following ways:

    • Navigate to the installation directory and run the ApmAgent.msi executable. The APM .Net Agent uninstallation wizard guides you through the uninstallation process.

      OR

    • Navigate to the Control Panel and remove Oracle APM .NET Agent.

  3. For silent uninstallation, run the following command from the installation directory:
    msiexec /quiet /log uninstall.log /x ApmAgent.msi
  4. If you did not stop the IIS server before you started the uninstallation, the uninstallation wizard displays a message that the APMAgent\config folder and the related .json files have not been deleted. Delete this folder and the .json files manually to remove all the configuration settings. If the folder is not deleted, these configuration settings will be used the next time you install Application Performance Monitoring.

Task 2: Remove APM .NET Agent References from Oracle Management Cloud

  1. On the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

  2. On the APM Agents page, select the APM .Net Agent that you want to remove. Use the Search feature to search for a specific APM .Net Agent.

  3. On the right side of the page, click the Actions menu and select Remove.

Uninstall APM Node.js Agent

This section discusses how you can uninstall APM Node.js Agents.

Upgrade APM Node.js Agent

Prerequisites:
  • Ensure that the environment variables are set appropriately.

  • Ensure that none of the files in the node_modules/oracle-apm folder are open.

  • Stop all the APM Node.js Applications.

  • Ensure you are logged in as the same user that installed the initial APM Node.js Agent.

To upgrade APM Node.js Agents:

  1. Download the latest APM Node.js Agent software.

  2. Extract the contents of the ZIP file to a local or shared directory.

  3. Download the agent install software.

    For information on the above steps 1 to 3, see Installing and Configuring APM Node.js Agents.
  4. Optionally, backup the existing APM Node.js Agent from $NODE_PATH.

  5. Install and provision the APM Node.js Agent by running the provisioning script.

    APM Node.js Agent displays the list of changes made by the upgrade process, and prompts for confirmation. On confirmation, the APM Node.js Agent is upgraded to the new version, and all customized properties are retained. The oracle-apm directory and the oracle-apm-config.json file in $NODE_PATH are backed up to ${STAGE_DIR}/temp.

    Note:

    Review the hostName property, since this value will overwrite the hostName which was used by the agent prior to upgrade.

    The upgrade computes a default hostname and uses the same. To override this default, rerun the provisioning script with ORACLE_HOSTNAME argument.

The following changes occur when you choose to upgrade APM Node.js Agent:
  1. A new version of APM Node.js Agent software will be installed in the node-modules folder.

  2. Updated oracle-apm-config.json will be copied over from STAGE_DIR to node-modules/oracle-apm/data folder. Existing file will be backed up with a .backup extension. Custom properties edited previously like proxy params etc will be copied over to the new file.

  3. All .cer certificate files will be converted into the correct format and copied over to node-modules/oracle-apm/data folder.

  4. Start the Node.js applications. The required config files will be copied to the respective NODE_APP_HOME/oracle-apm/data folder.

Troubleshooting Upgrade Issues

The upgrade overwrites oracle-apm agent files in the %NODE_PATH% folder. If any file from this folder (for example, oracle-apm-config.json file) is open during the upgrade, the following npm error occurs, and the upgrade process stops.

npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename '%NODE_PATH%\oracle-apm' -> '%NODE_PATH%\.oracle-apm.DELETE'

With the above error, the oracle-apm folder is deleted and hence, a rerun of the script is treated as a new install. Any locally modified properties are lost due to the rerun.

Workaround

Follow this workaround before attempting a rerun of the provisioning script:

  1. The backup copy of the old oracle-apm folder is available in the backup folder - ${STAGE_DIR}/temp (on Linux) and %TEMP% folder (on Windows). Copy this folder into node_modules.

  2. Ensure that none of the files from the node_modules/oracle-apm folder are open, and rerun the provisioning script.

Remove APM Node.js Agent

To disable and remove APM Node.js Agents, complete the following tasks:
  • Task 1: Remove the APM Node.js Agent from the application

  • Task 2: Delete APM Node.js files from the Application folder

  • Task 3: Uninstall APM Node.js Agent

Task 1: Remove the APM Node.js Agent from the application

  1. Navigate to the NODE_APP_HOME folder.

  2. Open the .js file that serves as the application’s entry point.

  3. In the .js file, search for the line that starts with require('oracle-apm'); and delete it.

    Code with Node.js Agent enabled:
    require('oracle-apm'); //Newly added require for Oracle APM instrumentation
      
    var express = require('express');
    var app = express();
     
    app.get('/', function (req, res) {
      res.send('Hello World!');
    });
     
    app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
    });
    Code after removing APM Node.js Agent
    var express = require('express');
    var app = express();
     
    app.get('/', function (req, res) {
      res.send('Hello World!');
    });
     
    app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
    });

Task 2: Delete APM Node.js files from the Application folder

  1. Navigate to the NODE_APP_HOME folder.

  2. Remove the directory oracle-apm where APM Node.js Agent was installed.

    cd $NODE_APP_HOME
    rm -r oracle-apm

Task 3: Uninstall APM Node.js Agent

  1. Set the environment variable PATH to include $Node_Home/bin.

  2. Run the following command to uninstall APM Node.js Agent:

    npm uninstall -g oracle-apm

Uninstall APM Ruby Agent

Follow these steps to uninstall the APM Ruby Agent.

Remove APM Ruby Agent

  1. Edit the application’s Gemfile and either comment out or remove the gem reference:

    gem 'oracle_apm', '~> 1.x.x’
  2. Restart your application server.

  3. Remove the agent gem from the gem library:

    gem uninstall oracle_apm
  4. To remove the Agent from the Oracle Management Cloud UI, in the Oracle Management Cloud Agents page, click APM Agents on the left navigation pane.

  5. In the APM Agents page, select the APM Agent that you want to remove. Click the Actions menu and select Remove.

Disable and Remove Agents for Licensing Purposes

Charges for APM usage vary by licensing model.

In the Universal Credits licensing model, APM Agents are counted based on the amount of data received, and not on the number of registered APM Agents. In this licensing model, you simply need to stop data from being received by Oracle Management Cloud in order to stop or pause charging. You do not have to completely remove the APM Agents in this case. To stop data transfer, you can do ONE of the following:

  • Disable APM data being sent to OMC: If you are using a Gateway, first disable End User Monitoring (EUM) (by setting the End User Monitoring Injection Type Property to None) using the APM Console and then stop the gateway agent. To deploy APM agents using gateways, refer to installation instructions for your type of agent. For detailed instructions on how to turn off EUM, see Enable and Configure End User Monitoring.
  • Stop the Application Server. Data will no longer be sent to OMC.
  • Remove APM Agents. For instructions on how to remove APM agents, see Upgrade APM Agents.
If you are using a Subscription-based licensing model the APM Agent count is based on the number of registered APM Agents. To stop charges related to APM Agent registrations:
  • Stop, Disable and then Remove the APM Agents so that data is no longer sent to OMC. For instructions on how to remove APM agents, see Upgrade APM Agents.