murvinlai murvinlai - 3 months ago 38
Node.js Question

How to find out the % CPU usage for Node.js process?

is there a way to find out the % cpu usage for a node.js process with the code? so that when the node.js server is running and detect the CPU is over certain%, then it will put an alert or console output.

Answer Source

Try looking at this code:

Network service for getting CPU of remote system and receiving CPU usage alerts...

Health.js serves 2 primary modes: "streaming mode" and "event mode". Streaming mode allows a client to connect and receive streaming CPU usage data. Event mode enables Health.js to notify a remote server when CPU usage hits a certain threshold. Both modes can be run simultaneously...