N
N
Nikita2019-11-07 19:04:34
JavaScript
Nikita, 2019-11-07 19:04:34

How to restart the server if the cpu usage has reached 100%?

I have a server started with pm2 in cluster mode. When there are too many requests to the server, it freezes and stops responding. Moreover, it is also not possible to connect to it via ssh. It remains only to restart it manually. Is it possible to somehow catch the moment when the load on the server becomes limiting and restart it at that moment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shohruh Shaimardonov, 2019-11-07
@snitron

Catch cpu usage
Here they showed how to do it
Well, then just if(cpuUsage > 85) then killAll()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question