Download PDF
Download page Run the Node.js Agent on Windows.
Run the Node.js Agent on Windows
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 is10101
proxyRequestPort
: Default is10102
proxyReportingPort
: Default is10103
All three ports must be inclusive of the 1024—65535 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]
Options:
-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.
.\node_modules\appdynamics\node_modules\appdynamics-proxy\proxy\runProxy.cmd
-j .\node_modules\appdynamics\node_modules\appdynamics-jre\jre /var/log/proxy
.\node_modules\appdynamics\node_modules\appdynamics-proxy\proxy\logs
10101
Execute the runProxy Command Manually on Windows Task Scheduler
You can schedule the runProxy command in the Windows Task Scheduler.
- Open Task Scheduler.
- Click Create Basic Task.
- In the General tab, enter a name for your task.
- Select Run whether user is logged on or not.
- Check Run with highest privileges.
- In the Triggers tab, add a new trigger. Set the trigger to when the device starts.
- In the Actions tab, create a new action. Set the action to Start a program.
- In the Program/script field, enter:
<app_root>/node_modules/appdynamics-proxy/proxy/runProxy.cmd
- In the Add arguments field, enter:
-d <app_root>/node_modules/appdynamics-proxy -j <app_root>/node_modules/appdynamics-jre/jre %TEMP% 10101
- In the Start in field, enter:
<app_root>/node_modules/appdynamics-proxy/proxy
- Click OK to finish the wizard.
- Reboot the system, and check the Task Manager for a Java process.