menu

Monitor your Node.js app in Heroku

In seconds, this tutorial will show you how to monitor a Node.js application with PM2 Plus in Heroku.

We assume that your app has already been wrapped with PM2. If not, follow the PM2 Heroku Tutorial.

Create an account

Register here.

In order to connect PM2 to the dashboard, you need to add your public and private keys in the environment.

To add your keys, run:

heroku config:set PM2_PUBLIC_KEY=XXXXXXXXXX PM2_SECRET_KEY=YYYYY

You can access your keys at the top right of your dashboard

Set the server name in PM2 Plus

Set the PM2_MACHINE_NAME environment variable to specify a server name:

heroku config:set PM2_MACHINE_NAME=heroku-server

The default server name is the hostname (HOST environment variable) with a few random characters.

Be careful, in case of duplicate hostnames the dashboard will receive data from both instances and flicker.

Next Steps

Complete your dashboard configuration.