Managing Node.js applications using PM2 Process Manager

Managing Node.js applications using PM2 Process Manager

Configure PM2 to manage Node.js applications

Follow the instructions below to configure PM2 to manage Node.js applications.

Steps to configure PM2
  1. Configure the processManagerEnabled key in the already created apminsightnode.json file.
  2. Pass the value as true.

    Example:
    {
    "licenseKey" : "xxxxxxxxxxxxxxxxxxxx",
    "appName" : "appName",
    "port" : 3000,
    "processManagerEnabled" : "true"
    }

  3. Res​​​​tart your Node.js application.
  1. The above configuration is only available for Node.js agents (v2.5.1 and above).
  2. In general, the process manager PM2 (version 2.0) is compatible with the APM Insight Node.js agent.

How Site24x7 handles the processes started by PM2

  1. Each process started by PM2 is treated as a separate instance in Site24x7.
             
  1. The instance's name is displayed as hostname:PM2_ID rather than hostname:port_number.
    For example: In the below screenshot, the three processes that are started using PM2 are displayed as zylker-0193:1, zylker-0193:2, and zylker-0193:3, where zylker-0193 is the hostname, and 1, 2, and 3 are the corresponding PM2_IDs.
             

  1. 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.

    • Related Articles

    • DC migration steps for APM Insight PHP agent

      Follow these steps to seamlessly migrate your Data Center: Obtain the new device key. Reinstall PHP Agent and S247DataExporter service with the newly obtained device key. Restart your web server and FastCGI Process Manager (FPM). Related Articles DC ...
    • DC migration steps for APM Insight Node.js agent

      Obtain the new device key. Update the licenseKey value in the apminsighnode.json file located at the <application root directory>. Log in to the server and delete the existing instance information file apminsight.json located at <application root ...
    • Adding APM Insight Node.js agent in Kubernetes via InitContainers

      To integrate the APM Insight Node.js agent into your Kubernetes applications using InitContainers, follow the steps given below: Step 1: Create an empty volume that will be used to copy the agent files during the initContainers process. Example: ...
    • DC migration steps for APM Insight agents

      For Server based installations 1. Obtain the new device key. 2. Update the license.key value in the APM Insight configuration file (or the environment variable mentioned) with the new device key. The location varies for each agent, as listed below: ...
    • Basic troubleshooting tips for the APM Insight Node.js agent

      If you have installed the APM Insight Node.js agent and are facing issues with it, follow the instructions below to troubleshoot your application. License key and logs Check whether your apminsightnode.json file contains the correct license key ...