P
P
Pavel Galkin2013-02-19 14:01:25
Debian
Pavel Galkin, 2013-02-19 14:01:25

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

3 answer(s)
P
Pavel Galkin, 2013-02-21
@skurudo

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.

N
Nikolai Turnaviotov, 2013-02-19
@foxmuldercp

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
.

S
stan_jeremy, 2013-02-19
@stan_jeremy

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 question

Ask a Question

731 491 924 answers to any question