monit-general
[Top][All Lists]
Advanced

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

Re: Monitor long running processes and kill them


From: Tom H
Subject: Re: Monitor long running processes and kill them
Date: Mon, 26 Mar 2012 20:16:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120316 Thunderbird/11.0

On 03/26/2012 01:27 PM, Martin Pala wrote:
Hi,

if the process does have a pidfile, it is usually updated only when the process 
starts - in such case you can use the timestamp test to restart the process, 
for example:
--8<--
check file myprocpid with path /var/run/myproc.pid
    if timestamp>  3 days then exec "/etc/init.d/myproc restart"
--8<--


We can easily implement uptime test to Monit in the future, so it can be 
possible to use somethig like:
--8<--
check process myproc with pidfile /var/run/myproc.pid
    start program = …
    stop program = ...
    if uptime>  3 days then restart
--8<--


Hi,

These are interesting strategies, as I have some similar requirement.

For my boxes which are yum based often I see a hung updates yum process that is a few days old, so I am looking for something to go and get those, as they cause a miss on the next run of yum in cron.

However the outputs of "ps -ef" and "ps aux" are not entirelely trivial to parse, as the "STIME" field seems to rollover from a "00:00" bare time of day, to a "MMMDD" format after 24 hours...

Cheers,
Tom



reply via email to

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