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.

    "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

    • 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 ...
    • How to add APM Insight Java agent without application restart?

      In general, after installing the APM Insight Java agent, you have to restart your application for the agent to capture monitoring data.   But in case of critical issues in the app, like sudden application slowness, where you haven't installed APM ...
    • APM Insight agent log paths

      Folder path to view One agent logs One agent logs can be found only in the common application folder in Windows (usually under C:\ProgramData from Vista onwards). Check the following folder path in Windows: C:\ProgramData\Site24x7APMOneAgent\Logs  ...
    • How to rename an APM Insight application?

      Site24x7 APM Insight doesn't support renaming applications/monitors from the web client. However, the application name of an existing application instance can be renamed in the apminsight.conf file and the agent associated with that instance will ...
    • How to modify the APM Insight PHP agent's communication port?

      The agent uses ports 20021 and 20022 by default. You can change these ports by modifying the appropriate directive in the zpa.ini file (Linux) or php.ini file (Windows), as well as in the apminsight.conf file (Linux and Windows).   Default ...