Prerequisite: Prerequisite: Ensure that your Node.js application is running version v16.20.2 or later, before proceeding to install APM Insight Node.js Agent.
To add a new Node.js Agent monitor in Applications Manager, go to the APM tab → Add New Monitor → Node.js


Use the following command to install an APM Insight Node.js agent from agent directory.
npm install <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install /users/joe/agent_minified
If you want to deploy APM Insight agent to all the Node.js applications on the computer, use the global option via -g flag.
npm install -g <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install -g /users/joe/agent_minified
This will create an APM Insight directory under node_modules.
Use the following command to install an APM Insight Node.js agent from application-installed directory.
npm install <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install /users/joe/agent_minified
Create a new file named apminsightnode.json and place it in the directory where you run the application. Add the below code snippet to the file:
{"licenseKey": "[LICENSE-KEY]","appName": "[APPLICATION-NAME]","port": "[APPLICATION-PORT]","apmHost": "[APM-HOST-NAME]","apmPort": "[APM-SSL-PORT]"}
Example:
{"licenseKey" : "APMI_ee42094f83dd841d16b9c56796c22b63bef00ac6918f547280947d1f6c2be1ea","appName" : "APMInsight_NodeJSapp","port" : "3000","apmHost": "localhost","apmPort": "8443"}
If you are using proxy, add the below code snippet:
{"licenseKey": "[LICENSE-KEY]","appName": "[APPLICATION-NAME]","port": "[APPLICATION-PORT]","apmHost": "[APM-HOST-NAME]","apmPort": "[APM-SSL-PORT]""proxyServerHost": "[PROXY-SERVER]","proxyServerPort": "[PROXY-PORT]","proxyAuthUser" : "[PROXY-USERNAME]","proxyAuthPassword" : "[PROXY-PASSWORD]"}
Note: If Applications Manager is configured with failover support, add multiple hosts in the apmHost column using the full URL.
For example:https://apm-prod-1:8443,https://apm-prod-2:8443
(Only HTTPS URLs are supported, and this feature is available from agent version 4.4.1.)
You can set configuration values as environment variables using the following keys:
licenseKey - APMINSIGHT_LICENSE_KEY
appName - APMINSIGHT_APP_NAME
port - APMINSIGHT_APP_PORT
proxyServerHost - APMINSIGHT_PROXYSERVER_HOST
proxyServerPort - APMINSIGHT_PROXYSERVER_PORT
proxyAuthUser - APMINSIGHT_PROXYAUTH_USER
proxyAuthPassword - APMINSIGHT_PROXYAUTH_PASSWORD
apm hostname - APMINSIGHT_APM_HOST
apm port - APMINSIGHT_APM_PORT
Include the given code in the first line of your Node.js application start file, before any other require statements.
| JavaScript | Code snippet |
|---|---|
| Common JS | require('apminsight'); |
| ECMAScript | import apminsight from 'apminsight'; |
| TypeScript | import AgentAPI from apminsight'; AgentAPI.config(); |
Alternatively, you can follow either of the methods given below, which are common across all JavaScript types.
Note: -r is used to pre-load the specified module (apminsight module here) at startup.Only CommonJS modules support -r. Use --import to pre-load a TypeScript or ECMAScript module.
Note: We highly recommend downloading the latest version of the APM Insight Node.js agent. However, if you need to download agent versions below 4.0.0 for any specific reason, please refer to the steps provided below.
To install APM Insight Node.js agent versions 1.7.2 to versons below 4.0.0, follow the instructions given below:
To add a new Node.js Agent monitor in Applications Manager, go to the APM tab → Add New Monitor → Node.js


Use the following command to install an APM Insight Node.js agent from NPM.
npm install <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install /users/joe/agent_minified
If you want to deploy APM Insight agent to all the Node.js applications on the computer, use the global option via -g flag.
npm install -g <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install -g /users/joe/agent_minified
This will create an APM Insight directory under node_modules.
Create a new file named apminsightnode.json in the same directory as your application start file. Add the below code snippet in the file:
{ "licenseKey" : "[LICENSE-KEY]", "appName" : "[APPLICATION-NAME]", "port" : "[APPLICATION-PORT]", "apmHost": "[APM-HOST-NAME]", "apmPort": "[APM-SSL-PORT]" }
Example:
{ "licenseKey" : "APMI_ee42094f83dd841d16b9c56796c22b63bef00ac6918f547280947d1f6c2be1ea", "appName" : "APMInsight_NodeJSapp", "port" : "3000", "apmHost": "localhost", "apmPort": "8443"}
If you use proxy connections, enter this code instead:
{ "licenseKey" : "[LICENSE-KEY]", "appName" : "[APPLICATION-NAME]", "port" : "[APPLICATION-PORT]", "apmHost": "[APM-HOST-NAME]", "apmPort": "[APM-SSL-PORT]" "proxyServerHost" : "[PROXY-SERVER]", "proxyServerPort" : "[PROXY-PORT]", "proxyAuthUser" : "[PROXY-USERNAME]", "proxyAuthPassword" : "[PROXY-PASSWORD]" }
Include the following code in the first line of your Node.js application start file.
If using Common JS: require('apminsight')() If using ES: import apminsight from 'apminsight'; apminsight.config()
Note:
If you are unable to add application port in apminsightnode.jsonfile, you can add it in your application start file as mentioned below:
require(‘apminsight’)({port:<application port>} )However other parameters like license key and app name should be added only in apminsightnode.json file.
Note: We highly recommend downloading the latest version of the APM Insight Node.js agent. However, if you need to download agent versions below 1.7.2 for any specific reason, please refer to the steps provided below.
Use the following command to install an APM Insight Node.js agent from NPM.
npm install <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install /users/joe/agent_minified
If you want to deploy APM Insight agent to all the Node.js applications on the computer, use the global option via -g flag.
npm install -g <Node.js-Agent-unzipped-path>/agent_minified
Example:
npm install -g /users/joe/agent_minified
This will create an APM Insight directory under node_modules.
Include the following code in the first line of your Node.js application source code, before any other require statement. Replace the variables with the values for your setup.
require('apminsight')({ licenseKey : '[LICENSE-KEY]', appName : '[APPLICATION-NAME]', port : [APPLICATION-PORT], apmHost: '[APM-HOST-NAME]', apmPort: [APM-SSL-PORT] })
Example:
require('apminsight')({ licenseKey : 'APMI_ee42094f83dd841d16b9c56796c22b63bef00ac6918f547280947d1f6c2be1ea', appName : 'Insight_NodeJS', port : 3000, apmHost: 'localhost', apmPort: 8443 })
If you use proxy connections, enter this code instead:
require('apminsight')({ licenseKey : '[LICENSE-KEY]', appName : '[APPLICATION-NAME]', port : [APPLICATION-PORT], apmHost: '[APM-HOST-NAME]', apmPort: [APM-SSL-PORT] proxyServerHost : '[PROXY-SERVER]', proxyServerPort : [PROXY-PORT], proxyAuthUser : '[PROXY-USERNAME]', proxyAuthPassword : '[PROXY-PASSWORD]' })
Thank you for your feedback!
It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.
Reviewer Role: Research and Development