Have you considered adjusting how often monit checks and set your cron job for log rotate to run in between? E.g. run monit every 5 seconds and have your log rotate happen on second 2. The PID would change, but shouldn't throw an alert.
On Thu, Nov 5, 2015 at 11:35 AM, Guillaume François < [email protected]> wrote: > Hello, > > So we should also concluded there is currently no way to delayed/avoid the > first alerts and that the only possibility is to "unmonitor" which can > cause issues and is against goal of Monit ? > > Explanation: if we "unmonitor" the check (sometime process, sometime > program) and an issue prevent the script in charge of "monitoring" again to > successfully finished, the service will be down and we won't get alerted as > it is "unmonitored". > > In fact "Log Rotation" was only one simple possible restart cause, but we > have lots of custom scripts also for our custom tools like "restart if some > conditions are met" with help of monit process exit code. > > Maybe a workaround would be to cut the action script in several part so > that even if the restart is failing, the monitoring is still issued. > > Another workaround would be to check the status of the "monit check" and > if this status is "unmonitor" for several cycles, force "monitoring" again > in order to be notified that something bad happens. > > What is your point of view about these ? > > Best Regards. > > > 2015-11-05 12:31 GMT+01:00 Martin Pala <[email protected]>: > >> Hello, >> >> monit tests if the process is running - it cannot differentiate that the >> process was stopped intentionally by 3rd party action ... if you shutdown >> the process intentionally during logrotate, you should disable its >> monitoring first (part of logratotation "prerotate" script): >> >> monit unmonitor myprocess >> >> and when logratotation finished, enable it again (part of logratotation >> "postrotate" script): >> >> monit monitor myprocess >> >> >> >> Regards, >> Martin >> >> >> >> > On 05 Nov 2015, at 11:42, Guillaume François < >> [email protected]> wrote: >> > >> > Hello, >> > >> > Everyday we got an "non-exist" then "exist" alert when the process is >> shutdown then started for log rotation purpose. >> > >> > We would like to NOT receive the email linked to this kind of behavior >> but still get the email when the process is really down for some time. >> > >> > We would like something like >> > >> > check process myprocess with pidfile /var/run/myprocesspid.pid >> > start program = "/usr/sbin/service myprocess start" >> > stop program = "/usr/sbin/service myprocess stop" >> > if failed port 5555 protocol tcp for 3 cycles then restart >> > if 5 restarts within 5 cycles then timeout >> > wanted -> alert on {exist, non-exist} only if 5 event in 5 >> cycles. >> > >> > can be interpreted as -> only send alert for event 'exist' and event >> 'non-exist' if alert is triggerred 5 time in the last 5 cycles >> > >> > We saw we can change the 'alert/noalert' rule for some 'email/event' >> but we cannot get a "conditional" rules for theses. >> > >> > Best Regards, >> > >> > >> > -- >> > -----BEGIN GEEK CODE BLOCK----- >> > Version: 3.1 >> > GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- >> K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? >> b(-) DI !D- G(+)>+ e+++ h--() r->$ y?* >> > ------END GEEK CODE BLOCK------ >> > -- >> > To unsubscribe: >> > https://lists.nongnu.org/mailman/listinfo/monit-general >> >> >> -- >> To unsubscribe: >> https://lists.nongnu.org/mailman/listinfo/monit-general > > > > > -- > -----BEGIN GEEK CODE BLOCK----- > Version: 3.1 > GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? > w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) > DI !D- G(+)>+ e+++ h--() r->$ y?* > ------END GEEK CODE BLOCK------ > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general >
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
