To monitor Node JS Applications we need to configure Node JS and Standalone agents. These two agents should run in the same machine.
- Standalone Agent
- Node JS Agent
1. Adding Standalone Agent:
Follow the steps for installing Standalone Agent.
Add the JVM argument -Disnodejs.standalone=true in the Standalone agent catalina.bat/sh file.
Note: After completing the installation of standalone Agent please don't start the agent. We need to start the agent later.
2. Adding Node JS Agent:
Step 1: Go to the Node.js agent's installation folder where you have installed Applicare itself (<ApplicareHomeDir>/agent/nodejs/) and copy the applicare-agent folder and its contents.
Step 2: Paste this folder and its contents inside the node_modules folder of your node js application. (Employee directory contains the node js application)
Step 3: Go into the applicare-agent folder (<live-server>/node_modules/applicare-agent) and execute the below command in the terminal:
After the successful completion of the install process "node_modules" folder will be created inside the "applicare_agent" folder.
Step 4: Move the agent.config.js file from the "applicare_agent" folder to the root directory of the application.
Step 5: Paste the below code in the first line of main file (usually called server.js or app.js) of the node js application
var applicareConfig = require('./agent.config.js');
var applicare = require('applicare-agent')(applicareConfig);
Step 6: Update the Node.js applicare agent configuration, especially the Node.js agent server name, Applicare Server IP, and port.
Step 7: If your Applicare server uses SSL, change the applicareServerSSL value into true and serverPort value into 8443 in the agent.config.js file.
Step 8: If the Applicare server is using self signed certificate for SSL feature, we need change the applicare_SSL_self_signed_cert value into true, otherwise false.
For every Node JS agent, the servername should be unique.
Standaloneagent port should be same in both the Node JS (agent_config.js) file and Standalone agent (server.xml) file.
We should set the same Server-name in both the Node JS (agent_config.js) file and Standalone agent (Catalina.bat/sh) file.
Assigning Standalone agent server name
One Node JS agent and one Standalone Agent:
Node JS servername : NodeServer,
Standalone servername : NodeServer,
Multiple Node JS agent and Standalone Agent:
Second Node JS servername : NodeD,
Second Standalone servername : NodeD,
Step 9: Restart the " Node JS" server.
Adding the Node JS Agent in Applicare server
Step 10: The Node JS agent will automatically add to Applicare controller.
Step 11:Login into Controller and see the Node JS agent is added in the Overview screen.