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: Martin Pala
Subject: Re: Adding one-time checks to monit?
Date: Mon, 25 Jun 2007 23:26:25 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070217 Iceape/1.1.1 (Debian-1.1.1-2)

The "every" statement will check the service after the given count of cycles, even on monit's start. It could be possible to extend monit and introduce "every" with fast start (i.e. check on first cycle and then every n cycles). We should however keep the current behavior for backward compatibility, since some users may depend on current slow-start "every".

Martin

Sergio Trejo wrote:
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 <mailto: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



------------------------------------------------------------------------

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




reply via email to

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