monit-general
[Top][All Lists]
Advanced

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

Re: Adding one-time checks to monit?


From: Sergio Trejo
Subject: Re: Adding one-time checks to monit?
Date: Sun, 24 Jun 2007 18:20:33 -1000

Martin,

Looking at the monit man page the "every" statement seems simple:

every  Validate this entry only at every n poll cycle.
            Useful in daemon mode when the cycle is short
            and a service takes some time to start.

But how can I indicate in monit to check a daemon for example at startup time (when monit itself is first fired up) and but then after monit is first run, then to only check a resource every n cycles. For example, I want monit to immediately check the apache daemon when monit it first loaded into memory itself, and then every 10 cycles thereafter it should check the apache daemon:

check process apache with pidfile "/opt/local/apache2/logs/httpd.pid" every 10 cycles
    if failed port 80 and protocol http then restart

Is there syntax to indicate to monit that it should look at something upon initialization? For example n = 0 like this?

check process apache with pidfile "/opt/local/apache2/logs/httpd.pid" every 0 cycles
    if failed port 80 and protocol http then restart

I ask because there may be resources that I want to check immediately when monit is itself first run, and then after this first-time check the super cycles for further checking can be much longer ( e.g., n = 10).

Thanks,

Serg

On 6/24/07, Martin Pala <address@hidden> wrote:
see the 'every' statement, which allows to skip given number of cycles

Martin

Sergio Trejo wrote:
> Hello all,
>
> As I'm getting used to the monit syntax, I am wondering if there is a
> way to author a monit configuration file such that moments after monit
> itself is first started (such as by inetd or on Mac OS X launchd), it
> will perform a check on the status of a resource (such as to see if the
> apache daemon is running) and then after that first-time immediate
> check, monit will only check the status of the resource every x number
> of cycles?
>
> Take the monit configuration snippet below. I set my high frequency
> check to once every 60 seconds. I then only want to ping my Apache httpd
> daemons to see if they are doing fine every 10 minutes. However, when
> monit itself is first run, I want it to not wait 10 minutes and in fact
> I want it to check the Apache daemons right away, then if everything is
> Ok it will regularly check every 10 minutes.
>
> Is this possible with the syntax magic of monit?
>
> Thanks,
>
> Serg
>
>     set daemon 60       # highest frequency monitoring is once every 60s
>
>
>     check process apache with pidfile
>     "/opt/local/apache2/logs/httpd.pid" every 10 cycles
>         if failed port 80 and protocol http then restart
>         if 2 restarts within 3 cycles then timeout
>
>
> ------------------------------------------------------------------------
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

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