monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Restart in chek file


From: Martin Pala
Subject: Re: Restart in chek file
Date: Thu, 15 Dec 2011 15:44:11 +0100

Hello Sergey,

the restart action for the file service calls stop->start programs with no 
delay - in comparison the process check waits for the process to stop, as monit 
knows the PID of the process which should terminate.

=> in your case the apache didn't start because when the start script was 
called, the stop was still in progress (in parallel).


It will be better to modify the configuration like this (delegate the process 
restart to standalone process check):

--8<--
check process apache with pidfile /var/run/httpd.pid
   start program = "/etc/init.d/httpd start"
   stop program = "/etc/init.d/httpd stop"

check file error_log with path /var/log/httpd/error_log
   start program = "/bin/bash -c '/usr/bin/monit restart apache'"
   if match 'signal Segmentation fault' then restart
   if match 'exit signal Aborted' then restart
   if match 'server reached MaxClients setting' then restart
   if 5 restarts within 10 cycles then exec "/bin/bash -c '/usr/bin/monit 
unmonitor error_log && /bin/sleep 3600 && /usr/bin/monit monitor error_log'"
--8<--

Regards,
Martin



On Dec 14, 2011, at 2:16 PM, Sergey Bondarev wrote:

> Hello ,
> 
> monit config:
> 
> check file error_log with path /var/log/httpd/error_log
>    start program = "/etc/init.d/httpd start" 
>    stop program = "/etc/init.d/httpd stop" 
>    if match 'signal Segmentation fault' then restart
>    if match 'exit signal Aborted' then restart
>    if match 'server reached MaxClients setting' then restart
>    if 5 restarts within 10 cycles then exec "/bin/bash -c '/usr/bin/monit 
> unmonitor error_log && /bin/sleep 3600 && /usr/bin/monit monitor error_log'"
> 
> 
> i try echo "signal Segmentation fault TEST2" >> /var/log/httpd/error_log
> 
> [MSK Dec 14 00:54:16] error    : 'error_log' content match [signal 
> Segmentation fault TEST2]
> [MSK Dec 14 00:54:17] info     : 'error_log' trying to restart
> [MSK Dec 14 00:54:17] info     : 'error_log' stop: /etc/init.d/httpd
> [MSK Dec 14 00:54:17] info     : 'error_log' start: /etc/init.d/httpd
> 
> 
> httpd stoped, but NOT starting again !!!
> 
> 
> 
> С уважением,
> Бондарев Сергей
> ООО Фирма "Техно-Р" 
> т. +7(4732)539954                                 mailto:address@hidden
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]