This page provides instructions on how to run the Node.js Agent in the Java proxy mode on a Windows machine. 

Proxy Ports

The Node.js Agent no longer supports the proxy as of version 21.9.

Depending on your Node.js environment on Windows, you may need to configure three ports in the Node.js require statement. These port settings are:

  • proxyCommPort: Default is 10101
  • proxyRequestPort: Default is 10102
  • proxyReportingPort: Default is 10103

All three ports must be inclusive of the 102465535 range.

Auto-Launch Windows Environments

The default behavior is for the agent to auto-launch the Java proxy, where proxyAutolaunchDisabled is false.

If you allow the agent to auto-launch and you have one Node.js process per machine, the agent will automatically use the default port values if they are available. In this case, you do not have to configure these settings.

If the default ports are not available, configure these settings to ports that are available in the require statement in the require statement.

If you have multiple Node.js processes on a single machine each reporting to its own proxy, each process needs its own set of ports. In this case, configure unique settings for all three ports in the require statement for each process.

Manual-Launch Windows Environments

Some environments have multiple Node.js processes on the same machine, all reporting to a single proxy. In these environments, it is necessary to launch the proxy manually, where proxyAutolaunchDisabled is true and to configure the three port settings.

The proxyCommPort setting in the require statement and the commPort option to the runProxy.cmd must be the same value. The agent and the proxy must use the same port.

The proxyRequestPort and the proxyReportingPort are two unused TCP ports that the user running the proxy has permission to bind to on Windows.

Each distinct app-tier-node combination on a single machine must use different request and reporting ports. Two processes reporting as the same app-tier-node may use the same request and reporting ports. Set these ports in the require statement for each app/tier/node combination.

Execute runProxy Manually on Windows

By default, the proxy component is automatically started when you start the agent. If you have configured the agent to manually launch the proxy, use the following command. 

Before any traffic is run on the instrumented server, execute runProxy.cmd to start the proxy using the following syntax. If you use the optional -d option, it must precede the -j option.

Usage: runProxy.cmd [-d <proxyDir>] -j <jreDir> [logDir] [commPort]

  -d <proxyDir> the directory where the proxy is installed; optional, defaults to the directory containing the runProxy.cmd script
  -j <jreDir> the directory where the JRE is installed; required
  logDir the directory the proxy should log to; optional, defaults to <proxyDir>\logs
  [commPort] port used for the proxy control channel on Windows; defaults to 10101; if specified it must match the proxyCommPort setting in the require statement

The following example assumes that the command is run from the root of the Node.js application instrumented by the agent.

		-j .\node_modules\appdynamics\node_modules\appdynamics-jre\jre /var/log/proxy 

Execute the runProxy Command Manually on Windows Task Scheduler

You can schedule the runProxy command in the Windows Task Scheduler.

  1. Open Task Scheduler.
  2. Click Create Basic Task.
  3. In the General tab, enter a name for your task.
  4. Select Run whether user is logged on or not.
  5. Check Run with highest privileges.
  6. In the Triggers tab, add a new trigger. Set the trigger to when the device starts.
  7. In the Actions tab, create a new action. Set the action to Start a program.
  8. In the Program/script field, enter: 
  9. In the Add arguments field, enter: 
    -d <app_root>/node_modules/appdynamics-proxy -j <app_root>/node_modules/appdynamics-jre/jre %TEMP% 10101
  10. In the Start in field, enter: 
  11. Click OK to finish the wizard.
  12. Reboot the system, and check the Task Manager for a Java process.