Managing Node.js applications using PM2 Process Manager

Managing Node.js applications using PM2 Process Manager

Configure PM2 Process Manager to manage Node.js applications

Follow the instructions given below to configure PM2 Process Manager to manage Node.js applications:
  1. Configure the processManagerEnabled key in the already created apminsightnode.json file.
  2. Pass the value as true.

    Example:
    {
    "licenseKey" : "xxxxxxxxxxxxxxxxxxxx",
    "appName" : "appName",
    "apmHost": "localhost",
    "apmPort": "8443"

    "port" : 3000,
    "processManagerEnabled" : "true"
    }

  3. Res​​​​tart your Node.js application.
  1. The above configuration is only available for Node.js agents (v3.1.2 and above).
  2. The PM2 Process Manager (version 2.0) is compatible with the APM Insight Node.js agent.

How Applications Manager handles the processes started by PM2

  1. Each process started by PM2 is treated as a separate instance in Applications Manager.
           
  1. The instance's name is displayed as hostname: PM2_ID instead of  hostname:port_number.
  2. For example: In the below screenshot, the four processes that are started using PM2 are displayed as apm-linux-test:0, apm-linux-test:1, and apm-linux-test:2apm-linux-test:3 where apm-linux-test is the hostname, and 0, 1, 2 and 3 are the corresponding PM2_IDs.
           

  1. The port number is the same for all instances. Hence, PM2_ID is used to differentiate them.
  2. Each instance started by PM2 is treated as a separate APM instance and requires its own advanced monitor license.



                  New to ADSelfService Plus?