I can see how to alert when a regex appears in a log file. I can see how to alert when a regex does not appear on EVERY line of a log file. But I can't see how to alert when a regex has not appeared in a log file over a period of time.

I could create a bash script which regex's the file for me, and writes out to a file which monit monitors, but would rather keep the solution within monit.

Any help would be appreciated.

link|improve this question
feedback

1 Answer

From the manual:

IF [NOT] MATCH {regex|path} [[] CYCLES] THEN action

The content is only being checked every cycle. If content is being added and removed between two checks they are unnoticed.

Use the CYCLE option. The limitation I see here is the cycles. The manual defaults to 300 seconds (5 minutes). Determine how many cycles are needed and then tweak the alerting.

link|improve this answer
Thanks John. I'll give it a go on my server and report back. – user53528 Sep 7 '10 at 5:24
Not sure that this works John. I entered the following: – user53528 Sep 7 '10 at 21:51
check file system.log with path /var/log/system.log if NOT match "BLAH" within 2 cycles then alert group prices – user53528 Sep 7 '10 at 21:51
This will alert on every line which does not match the pattern "BLAH". Which is different to what I want to do. I want to alert when I don't receive something over a period of time. – user53528 Sep 7 '10 at 21:52
If that entry is not working I would then post to the monit mailing list and ask them. Sorry if that didn't help. – John Sep 9 '10 at 0:31
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.