Monitoring PM2 in production
Blog post from New Relic
In large-scale Node.js production environments, monitoring multiple applications is crucial, and PM2 serves as an effective process manager for managing Node.js applications. PM2 offers features such as automatic restarts, load balancing, and detailed telemetry data, including CPU and memory usage, which are vital for troubleshooting and performance analysis. Although there is no direct integration between PM2 and New Relic agents, a custom integration using Flex can be created to capture PM2's metrics and export them to New Relic. This process involves configuring a file using the PM2 jlist API, sanitizing the JSON data with JQ, and utilizing New Relic's Query Language (NRQL) to analyze and visualize the data. The integration enhances application performance monitoring and root-cause analysis by providing a unified view of process-level insights, including version control and deployment details, enabling developers to set up personalized alerts and dashboards for effective monitoring.