Using third-party monitoring tools
Node is a new technology for which there are few mature application monitoring tools. Some independent developers, along with established companies in the application monitoring space, have jumped in to fill this gap. In this section, we'll look at PM2 as a process manager and monitor and also have a look at Nodetime.
PM2
PM2 is designed to be an enterprise-level process manager. As discussed elsewhere, Node runs within a Unix process, and its child_process
and cluster
modules are used to spawn further processes, typically when scaling an application across multiple cores. PM2 can be used to implement the deployment and monitoring of your Node processes both via the command line and programmatically. Here, I will focus on programmatically using PM2 for process management and show you how to use it to monitor and display process activity.
Install PM2 globally:
npm install pm2 -g
The most straightforward way to use PM2 is as a simple process runner. The following...