监控 CPU/Memory

PM2 gives you a simple way to monitor the resource usage of your application. You can monitor memory and cpu very easily, straight from your terminal:

$ pm2 monit

Keymetrics 监控

Keymetrics Dashboard

If you manage your NodeJS app with PM2, Keymetrics makes it easy to monitor and manage apps accross servers. Feel free to try it:

Discover the monitoring dashboard for PM2

Thanks in advance and we hope that you like PM2!

大内存重启

PM2可以根据内存限制重启应用.

CLI

$ pm2 start big-array.js --max-memory-restart 20M

JSON

{
  "name"   : "max_mem",
  "script" : "big-array.js",
  "max_memory_restart" : "20M"
}

编程

pm2.start({
  name               : "max_mem",
  script             : "big-array.js",
  max_memory_restart : "20M"
}, function(err, proc) {
  // Processing
});

单位

单位可以是 K(ilobyte), M(egabyte), G(igabyte).

50M
50K
1G