[Top][All Lists]

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

Re: How to monitor processes started from Cron?

From: Martin Pala
Subject: Re: How to monitor processes started from Cron?
Date: Sat, 11 Sep 2010 09:53:12 +0200

You can set the service monitoring mode to "manual" and enable the service monitoring from the cron script when it starts - i.e. the script will contain line such as this:

        #script beginning:
/usr/bin/monit monitor mycronjob
        #script body
        #script end:
/usr/bin/monit unmonitor mycronjob

and the mycronjob settings for monit:

    check process mycronjob ...
        stop program = "/usr/bin/killall mycronjob"
        mode manual
        if cpu usage > 80% then stop

=> by default the service is not monitored, the monitoring is enabled/disabled from the cronjob. If the cpu usage exceeds the limit, monit kills the cronjob and disables its monitoring as result of stop action too.


On Sep 10, 2010, at 11:07 PM, wam rewam wrote:

I am starting some processes at specific times using Cron. I would like to monitor them using Monit, but just to kill them if they are using too much resources. I do not want Monit to start or restart them, and I would need Monit to be "fine" with the fact that they are not running all the time.

I found a way to do it by only specifying a stop method, and not a start one for these processes. Monit does "try" to start them but it fails (and this is fine), and it does kill the processes as per my resources criteria. So it kind of works. But I have the following problems:

- my log file becomes huge and impossible to read: it is full of "error: XX process is not running" and "error: monit: Start or stop method not defined -- XX"

- if Monit stops one of these processes (when resource limits are exceeded), it also stops monitoring them... whereas I would need it to be "ready" to monitor for next time the process is started from Cron.

Is there a better way to monitor such Cron-started processes?

Thanks a lot!
To unsubscribe:

reply via email to

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