You can use the instructions in Install the Node.js Agent to install the Node.js Agent on Node.js applications running on Windows. However, there are a few additional considerations that apply to Windows environments, as described here.
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 = 10101
- proxyRequestPort: default = 10102
- proxyReportingPort: default = 10103
All three ports must be in the range 1024-65535 inclusive.
Auto-Launch Windows Environments
The default behavior is for the Agent to auto-launch the proxy (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, in the require statement, you must configure these settings to ports that are available.
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, in the require statement for each process, configure unique settings for all three ports.
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 (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. Use the command described here only if you have configured the agent for manual proxy launch.
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.
This example assumes that the command is run from the root of the Node.js application instrumented by the agent.
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 computer starts.
- In the Actions tab, create a new action. Set the action to Start a program.
- In the Program/script field, enter the following:
- In the Add arguments field, enter the following:
-d <app_root>/node_modules/appdynamics-proxy -j <app_root>/node_modules/appdynamics-jre/jre %TEMP% 10101
- In the Start in field, enter the following:
- Click OK to finish the wizard.
- Reboot the system, and check the Task Manager for a Java process.