How to Monitor Node.js Applications Using PM2
PM2 is a daemon process manager that will help you manage and keep your application online 24/7.
The latest PM2 version is installable with NPM or Yarn:
npm install [email protected] -g
yarn global add pm2
Start an app
The simplest way to start, daemonize and monitor your application is by using this command line:
pm2 start app.js
Or start any other application easily:
pm2 start bashscript.sh pm2 start python-app.py --watch pm2 start binary-file -- --port 1520
Managing application state is simple here are the commands:
pm2 restart app_name pm2 reload app_name pm2 stop app_name pm2 delete app_name
app_name you can pass:
allto act on all processes
idto act on a specific process id
List managed applications
List the status of all application managed by PM2:
Terminal Based Dashboard
Here is a realtime dashboard that fits directly into your terminal
Web Interface monitoring PM2
PM2 Plus (PM2 Web Based Dashboard) is an advanced and real-time monitoring and diagnostics tool. It provides features for both hardening your current PM2 and monitoring applications in production across servers. It features issues and exception tracking, deployment reporting, real-time logs, email and slack notification, custom metrics monitoring, and custom actions center.
link PM2 to
Now on the
PM2.io main interface, you should have one server connected, showing a list of all your Nodejs processes in expanded mode. For each server connected, the dashboard shows you server hardware components such as the amount of RAM and CPU type. It also shows the version of Nodejs and PM2 currently installed.
To unlink a server from the
app.pm2.io monitoring dashboard, run the following command on the server to unlink:
Use the following command to update Pm2
PM2 is one of most common daemon process manager used to Nodejs application in your production servers. We hope this article helps you to manage PM2 process manager through your web interface and command line. TheStack is one of the best web hosting providers that offer premium shared web hosting, cheap dedicated server hosting, VPS server, WordPress hosting, server management and monitoring and DevOps support services. Be assured with our services and reach out to our team of experts to know more.