monit-general
[Top][All Lists]
Advanced

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

Re: content match


From: Petra Humann
Subject: Re: content match
Date: Wed, 10 Jun 2015 15:04:41 +0200

Hello Martin,

thank you very much. Now I have:

check file system.log with path /var/log/system.log
        if match "^[^\t].* my_string" then exec "/bin/bash -c '
                my_command ; /usr/local/bin/monit unmonitor system.log
                '"

check process myprocess
      with pidfile /var/run/myprocess.pid
      if totalmem > 600.0 MB for 2 cycles then exec "/bin/bash -c '
                /usr/local/bin/monit monitor system.log; /usr/local/bin/monit 
unmonitor myprocess
                '"

check process myotherprocess
      with pidfile /var/run/myprocess.pid 
      start program = "…."
      stop program = "…."
      if totalmem > 2500.0 MB for 3 cycles then restart
      if changed pid then exec "/bin/bash -c '
                /usr/local/bin/monit monitor myprocess"
                '"

All conditions are working, but the changed pid condition doesn't. Why?

Thank you.
Petra


Am 06.06.2015 um 13:51 schrieb Martin Pala <address@hidden>:

> Hello Petra,
> 
> there is no native support for pausing monitoring for x seconds after some 
> event occurred.
> 
> It is possible to wait for x errors before the event is triggered (i.e. 
> require multiple occurrences of the problem) - i’m not sure if it corresponds 
> your needs in this case, example usage:
> 
>       if match “my_string” for 2 cycles then exec “my_command”
> 
> => the “my_string” pattern will have to occur in the file for two consecutive 
> cycles before the “my_command” is executed.
> 
> 
> If you need to execute the command on first error occurrence and pause the 
> monitoring you’ll need to “unmonitor” the  service (“monit unmonitor 
> system.log”) … you can call this from your exec action’s script - to enable 
> the monitoring after x seconds, you’ll need to do “monit monitor system.log” 
> - for example scheduling it from the same script using “at”. 
> 
> 
> Regards,
> Martin
> 
> 
>> On 02 Jun 2015, at 10:53, Petra Humann <address@hidden> wrote:
>> 
>> Hello,
>> 
>> I have in monitrc:
>> 
>> check file system.log with path /var/log/system.log
>>      if match "my_string" then exec "my_command"
>> 
>> How can I pause the monitoring of this file for x seconds, if this condition 
>> occured once?
>> 
>> Thank you very much.
>> 
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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