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

前端 未结 6 1321
挽巷
挽巷 2021-01-31 18:59

Is there a way to find out the cpu usage in % for a node.js process via code. So that when the node.js application is running on the server and detects the CPU exceeds certain %

6条回答
  •  余生分开走
    2021-01-31 19:56

    Try looking at this code: https://github.com/last/healthjs

    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...

提交回复
热议问题