monit-general
[Top][All Lists]
Advanced

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

Re: Monit - file checks with reminders


From: Martin Pala
Subject: Re: Monit - file checks with reminders
Date: Thu, 12 Dec 2013 20:27:30 +0100

Hi,

the content match test is incremental, designed primarily for log files - it 
fires alert only for the new text and remembers position for the next cycle (it 
resets the position if inode number changed or file size grew or shrunk + there 
is exception for /proc/ files which are always read from start). If no new 
content matched during the next cycle, the error flag is reset.

A workaround could be to use the "check program" with custom script (can be 
based on "grep"), that which will return error status if the file contains the 
pattern, related documentation:
http://www.mmonit.com/monit/documentation/monit.html#program_status_testing

We can maybe add option for the content match test which will force Monit to 
always retest the whole file (similarly to what Monit does automatically if the 
file is part of the /proc/ filesystem).

Regards,
Martin



On 12 Dec 2013, at 15:28, Ron Kelley <address@hidden> wrote:

> Just to follow up on this.  I started monit with the "-v" flag (verbose), and 
> this is what I get in the monit.log file:
> 
> 'MegaRAID' content match skipped - file size nor inode has not changed since 
> last test
> 
> It seems monit is having an issue noticing the file has been updated.  My 
> script overwrites the MegaRAID.log file each time the cron job is run.  From 
> the monit man page:
> 
> FILE CONTENT TESTING
> --------------------
> The content is only being checked every cycle. If content is being added and 
> removed between two checks they are unnoticed
> On startup the read position is set to the end of the file and Monit continue 
> to scan to the end of file on each cycle. But if the file size should 
> decrease or inode change the read position is set to the start of the file.
> 
> 
> Unless I read this wrong, the alert should be raised because the content of 
> the file changed.
> 
> 
> Thanks.
> 
> -Ron
> 
> 
> 
> On 12/12/13, 9:18 AM, Ron Kelley wrote:
>> Greetings all,
>> 
>> I searched through the archives and could not find an exact match to my 
>> problem.
>> 
>> I have monit v5.6 running on CentOS 6.3, and I am trying to get the "check 
>> file" function working with the reminder option.  For some reason, monit 
>> never sends a new alert on the reminder cycle.  Here is what I have:
>> 
>> -----------------------------------------------------------------------------
>> set daemon 30
>> set alert address@hidden
>> ...
>> ...
>> ...
>> check file MegaRAID with path /var/log/MegaRAID.log
>>    alert address@hidden with reminder on 4 cycles
>>    if match "Degraded" then alert
>>    if match "Failed" then alert
>> -----------------------------------------------------------------------------
>> 
>> Monit will issue the first alert then will not alert anymore.  I have a cron 
>> job that runs every minute to get the RAID card status and put the result in 
>> the /var/log/MegaRAID.log file (thus, the file gets overwritten every 
>> minute).  Here is what the MegaRAID.log file looks like:
>> 
>> ---------------------------------
>> LSI MegaRAID   Info - Thu Dec 12 09:06:04 EST 2013
>> ---------------------------------
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Failed
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Online
>>                 State              : Partially Degraded
>>                 State              : Partially Degraded
>> 
>> 
>> Since this file is updated every minute, I was expecting to get an alert 
>> every 2 minutes (daemon at 30secs, with reminder on 4 cycles == thus, 2 
>> mins).
>> 
>> Can someone please let me know what I need to do to get this working?
>> 
>> Thanks,
>> 
>> -Ron
> 
> -- 
> Thanks,
> 
> -Ron
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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