I'd like to monitor any node.js process that pops up on my machine and eventually print out the maximum memory used by the process when the process dies. Is there any monitoring software that does this already and if not, what is the best way to go about doing this?
Since I know which type of Node.js processes I want to monitor, I could put a check (setInterval) inside each process and then just log the maximum memory used that way. I believe I can access the amount of memory used via process.memoryUsage() and just store the maximum amount and log that upon exit using process.on('exit').
However, is there a way to monitor a group of node.js processes somehow? How do I know which group I am looking at? In other words, how can I mark certain node.js processes so that I can monitor different groups?