This guide will help you install and setup the pm2 NodejJS process monitor PM2 from Keymetrics.io for free and manage your node apps performance and exceptions.
What is PM2?
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. This is the steps I used on Ubuntu 16.04. This is NOT a paid endorsement (just self-documenting).
Key Features of PM2
PM2 offers web-based monitoring dashboard, exception reporting, load balancer, CPU and memory monitoring, transaction tracer and much more for NodeJS apps.
What is PM2?
Official page: http://pm2.keymetrics.io/
More info https://www.npmjs.com/package/pm2
Install PM2
Install Output
PM2 Pricing
PM2 appears to be for high-end apps but I am only using the free version or PM2 (thanks KeyMetrics)
Create a bucket for your node app
Login to keymetrics.io,
Click Generate New Bucket
Give the bucket a name etc.
You can now link your bucket with your local pm2 installation (keep the keys private (this one no longer exists))
Linking your local pm2 installation with your keymetrics bucket
To add an existing node app to PM2 type the following.
You can view node apps that pm2 is managing by typing
I had a two CPU VM and I found that the app I added was added to each of the two CPU (I only needed one) so I needed to delete the second app on my second core
Restart the API
You can add a single node apps one 1, 3 or max available CPU’s
Again, to add an existing node app to PM2 type the following.
Now you can view node app data online. If you don’t have a node app ready you can use the test app.
You can monitor your node app locally too from the CLI.
You can also view a demo bucket at keymetrix.io
PM2’s one age documentation can be found here.
I hope this guide helps someone.
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
Revision History
v1.0 Initial post