Re: How to watch file content tests for several events in the same cycle?

Tino Hendricks <[email protected]>
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <[email protected]>
Marcus,

my suggestion as usual pleas for use of a script, because I don’t think monit can do what you need out of the box.

Something like 

if [[ $((`tail -3 /var/log/log_to_watch | grep CRITICAL | wc -l`)) -gt 1 ]] ; then …

might be a way to go?

Take care

Tino

> Am 26.09.2019 um 11:11 schrieb Marcus Mülbüsch <[email protected]>:
> 
> Hello all,
> 
> the following lines alert me if the logfiles contains 2 Criticals in 2 minutes and ignores single Crits:
> 
>> check file log_to_watch with path /var/log/log_to_watch
>>  if match "CRITICAL" for 2 times within 2 cycles then alert
> 
> However, my Crits mostly happen in the same second. I can safely ignore a single one, but want monit to alert me if several happen at once (or in short succession). The above lines does not do that.
> 
> Unfortunately I can't figure out how to proceed. Is there a way?
> 
> Any suggestion would be highly appreciated.
> 
> Marcus
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.