Answer the question
In order to leave comments, you need to log in
Restart a process if it rapes the processor?
I'm trying to limit the appetites of the process using Monit. If it suddenly eats the CPU, then it would reboot, but for some reason Monit ignores it and does not restart the process.
Tried these conditions:
if totalcpu > 60% for 2 cycles then restart
...
if cpu usage > 60% for 2 cycles then restart
...
if cpu > 60% for 2 cycles then restart
and none of the designs worked.
CHADNT?
Maybe there are other means besides the monit or any ideas?
I've run out of all sorts so far.
PS: Debian 6 OS, OpenVZ virtualization platform
Answer the question
In order to leave comments, you need to log in
Constructions like “if cpu > 60% for 2 cycles then restart” are quite working and I shouldn’t have sinned on monit. It turned out that the CPU value inside the monit container takes from the general one and they are not at all like what we see in top/htop.
The solution is to catch the moment of unstable behavior of the process and take readings using the monit status command.
1. For good, it is necessary to profile the process in order to understand where the plug is and remove the ITSELF reason for such a rake.
2. Set up quotas for a process and/or a virtual machine so that it (the process/virtual machine) does not get 100% of the processor/memory/iops/iowait
.
Debian is not at hand, but it works on Ubuntu:
check process apache2 with pidfile /var/run/apache2.pid
if totalcpu > 60% for 2 cycles then restart
are you sure you are monitoring the correct process?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question