Install APM Insight Node.js agent (versions 2.x and 3.x)

How to install the APM Insight Node.js agent (versions 2.x and 3.x)?

Warning
We highly recommend you download the latest version of the APM Insight Node.js agent. However, if you need to download agent versions v2.x or v3.x for some reason, kindly refer to the below given steps. 
1. Open your Node.js application.
2. Access the node packet manager (NPM).
3. Use the command npm i apminsight --save to install an APM Insight Node.js agent from NPM. This will create an APM Insight directory under node_modules.
4. Create a new file named apminsightnode.json and place it in the directory where you run the application. Add the below code snippet in the file. 
{
   "licenseKey" : "<license-key>",
   "appName" : "<application-name>",
   "port" : <application-port>
}
If you are using proxy:
{
   "licenseKey" : "<license-key>",
   "appName" : "<application-name>",
   "port" : <application-port>,
   "proxyServerHost" : "<proxy-server>",
   "proxyServerPort" : <proxy-port>,
   "proxyAuthUser" : "<proxy-user-name>",
   "proxyAuthPassword" : "<proxy-password>"
}
5. Follow any of the below:
  1. If you are using Common JS, follow the below instruction:
    Include the following code in the first line of your Node.js application start file before any other require statements.
      require('apminsight')()
    1. If you are using ES, follow the below instruction:
      Include the following code in the first line of your Node.js application start file before any other require statements.
        import apminsight from 'apminsight';
        apminsight.config()
    1. If you are using a typescript application, follow the below steps:
                    i. Create a file named apminsight.d.ts in the same directory as your application start file.
                    ii. Add the below line to the apminsight.d.ts file.
                         declare module "apminsight";
                    iii. Add the below lines to the first line of your application start file.
                          import * as apminsight from 'apminsight'; 
                          apminsight.config()
    6. Copy and paste the license key in the apminsightnode.json file.
    7. Restart your application and make few transactions to view data in APM Insight client. 

    If you are unable to add application port in the apminsightnode.json file, you can add it in your application start file as mentioned below. However other parameters like license key and app name should be added only in apminsightnode.json file. To add application port in application start file:
    require('apminsight')({
        port: <application-port>
    });
    

    Set configuration values as environment variables:

    You can set configuration values as environment variables using the following keys:
    1. License key - APMINSIGHT_LICENSE_KEY 
    2. Appname - APMINSIGHT_APP_NAME 
    3. Port - APMINSIGHT_APP_PORT
    4. proxyServerHost - APMINSIGHT_PROXYSERVER_HOST
    5. proxyServerPort - APMINSIGHT_PROXYSERVER_PORT
    6. proxyAuthUser - APMINSIGHT_PROXYAUTH_USER
    7. proxyAuthPassword - APMINSIGHT_PROXYAUTH_PASSWORD
    8. hostLicense - APMINSIGHT_HOSTLICENSE
      • Related Articles

      • How to identify and resolve conflicts between other APM products and the APM Insight .NET agent

        Problem statement: You are experiencing either of the below issues and suspect that another APM product is interfering with the Site24x7 .NET agent. 1. The .NET monitor is not created under APM > APM Insight > Applications, even after the .NET agent ...
      • APM Insight integration for Next.js in Kubernetes

        To integrate the Site24x7 APM Insight Next.js agent into your Kubernetes application using initContainers with the prebuilt agent image, follow the steps below: Prerequisites A Next.js application container image The Site24x7 APM Insight license key ...
      • Bundled .NET and .NET Core agents in a single MSI

        In APM Insight .NET agent version 6.8.0, the .NET and .NET Core agents have been bundled into a single MSI, enabling unified monitoring of both application types. Upgrade requirements for .NET Core agent 6.7 and below If you're using .NET Core agent ...
      • How to uninstall the Site24x7 Windows Server Monitoring Agent

        Method 1: To uninstall the Site24x7 Windows Server Monitoring Agent, click the link below: https://staticdownloads.site24x7.com/server/Site24x7WindowsAgentUninstall.zip Unzip and execute the Uninstall.bat file in the Command Prompt as an ...
      • Unable to add SQL insight monitor

        If the SQL Insight monitor is not getting added even after entering your credentials, try these troubleshooting steps: Ensure that the Auto-discover applications feature is enabled. If not, you will need to trigger discovery using the Discover ...