monit-general
[Top][All Lists]
Advanced

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

Re: limit check file alerts


From: Tino Hendricks
Subject: Re: limit check file alerts
Date: Mon, 25 Mar 2019 13:09:39 +0100

Marc,

just a simple thought: Define this check with a „noalert“ statement and define 
an additional one with softer criterions (like „… for 5 cycles…“) which does 
real alerts?

Cheers!

Tino

> Am 22.03.2019 um 22:46 schrieb Marc Rossi <address@hidden>:
> 
> I have a process that creates a logfile named 
> "/var/log/foo-YYYYMMDD-HHMMSS.log" at startup. To simplify things I create a 
> soft-link to the latest file named "/var/log/foo.log".
> 
> Whenever the process is restarted it deletes the soft-link (since it is 
> pointing to a file that is no longer current). I have the following "check 
> file" setup to re-create that soft-link and start monitoring the file. Only 
> problem is it still generates a "file doesn't exist" event after 3 cycles 
> before creating the soft-link and a "file exists" event.
> 
> check file foo.log with path /var/log/foo.log
>       if not exist for 3 cycles then exec "/bin/bash -c 'ln -s `ls -t 
> /var/log/foo-*.*.log|head -n1` /var/log/foo.log'"
>       if content != "\[INFO\]" then alert
>       group foo
> 
> Any ideas on how to prevent the initial "file doesn't exist" event?
> 
> (just to eliminate one of obvious solutions. the soft link cannot be created 
> from the startup script in between unmonitor/monitor commands to foo.log as I 
> don't control the app startup. the foo.log entry stays monitored 24x7 as the 
> soft-link is not deleted at app shutdown which keeps things simple)
> 
> Marc
> -- 
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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