These statements are equal (see monit manual for more details: 
https://mmonit.com/monit/documentation/monit.html#FAULT-TOLERANCE):

        #short format:
        if status !=0 for 2 cycles then alert

        # long format:
        if status !=0 for 2 times within 2 cycles then alert

The long format ("X within Y cycles") is useful if X != Y, which you can 
achieve using short format, for example:

        if status !=0 for 3 times within 5 cycles then alert

If X == Y, you can use short or long format - they work the same.


Best regards,
Martin


> On 11 Aug 2016, at 16:57, Vikram Kone <[email protected]> wrote:
> 
> I'm a bit confused. According to the issue page you linked to, what I have 
> originally is the right thing.
> 
> if status !=0 for 2 cycles then alert
> 
> But you are saying, this is right 
> 
> if status !=0 for 2 times within 2 cycles then alert
> 
> Aren't both of them same?  Can you explain the difference?
> 
> From what I understand,  the way i can read the first setting is 
> 
> if status !=0 for 2 attempts then alert
> 
> Is that wrong?
> 
> 
> On Aug 11, 2016 12:50 AM, "Martin Pala" <[email protected] 
> <mailto:[email protected]>> wrote:
> yes
> 
> 
>> On 11 Aug 2016, at 08:54, Vikram Kone <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> check program test_pgm with path "/bin/bash /var/run/test.sh"
>> with timeout 3600 seconds
>> every 2 cycles
>> if status !=0 for 2 cycles then alert
>> In this case let's say test.sh takes 45 mins to finish (either success or 
>> failure) each time. Will the above config, still holds correct ie, will it 
>> alert if the pgm failed twice consecutively?
>> 
>> On Wed, Aug 10, 2016 at 11:51 PM, Vikram Kone <[email protected] 
>> <mailto:[email protected]>> wrote:
>> and how does timeout comes into play here
>> 
>> 
>> 
>> On Wed, Aug 10, 2016 at 11:38 PM, Vikram Kone <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Do you mean this one?
>> if status !=0 for 2 times within 2 cycles then alert
>> 
>> On Wed, Aug 10, 2016 at 11:06 PM, Martin Pala <[email protected] 
>> <mailto:[email protected]>> wrote:
>> The second configuration is correct.
>> 
>> The combination of "every" with "X cycles" is confusing, we'll modify the 
>> syntax: 
>> https://bitbucket.org/tildeslash/monit/issues/174/the-for-x-cycles-is-confusing-if-the-test
>>  
>> <https://bitbucket.org/tildeslash/monit/issues/174/the-for-x-cycles-is-confusing-if-the-test>
>> 
>> Best regards,
>> Martin
>> 
>> 
>>> On 11 Aug 2016, at 04:48, Vikram Kone <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> I have a monit check program as follows
>>> 
>>> check program test_pgm with path "/bin/bash /var/run/test.sh"
>>> every 2 cycles
>>> if status !=0 for 2 cycles then alert
>>> Let's say my monit daemon is set to run every 60 seconds which means each 
>>> cycle is 1 minute. I want to run my program every 2mins and alert if it 
>>> fails twice in a row
>>> 
>>> Is what I have above correct? or should I say
>>> 
>>> if status !=0 for 4 cycles then alert
>>> or should it be
>>> 
>>> if status !=0 for 2 times within 2 cycles then alert
>>> --
>>> To unsubscribe:
>>> https://lists.nongnu.org/mailman/listinfo/monit-general 
>>> <https://lists.nongnu.org/mailman/listinfo/monit-general>
>> 
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general 
>> <https://lists.nongnu.org/mailman/listinfo/monit-general>
>> 
>> 
>> 
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general 
>> <https://lists.nongnu.org/mailman/listinfo/monit-general>
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general 
> <https://lists.nongnu.org/mailman/listinfo/monit-general>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

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

Reply via email to