The reminder and alert-on-state-change-only behaviour is for alert action only ... not exec action. The exec action is executed each time the test failed (as described in the previous email) - the test frequency is driven by "set daemon" (monit poll cycle) and "every" option, which allows to skip some cycles.
> On 26 Mar 2015, at 15:09, Rubin, Alan <[email protected]> wrote: > > It seems like the exec calls my script and it triggers every minute. This > seems to be outside of the reminder so where is this interval set? > Can you show me an example of how I can control this in a script? My script > captures some performance data from a script when the threshold is reached > but I only want it executed -emailed to me once. > > From: [email protected] > [mailto:[email protected]] On Behalf Of > Martin Pala > Sent: Tuesday, March 24, 2015 8:11 AM > To: This is the general mailing list for monit > Subject: Re: monit alerts with exec > > Hello, > > the native alert action sends the alert on state change only (the reminder > option may send alert again if the problem persists). > > The exec action is executed each time the test failed, as monit delegates > full responsibility for the event processing to the script and cannot assume > the script is to be executed on state change only. You can modify your script > to handle state change only (monit provides set of environment variables to > the script: http://mmonit.com/monit/documentation/monit.html#ENVIRONMENT > <http://mmonit.com/monit/documentation/monit.html#ENVIRONMENT>) or you can > use M/Monit (www.mmonit.com <http://www.mmonit.com/>) as Monit extension, > which has better alert rules support (including custom alert scripts > execution on state change). > > Regards, > Martin > > > On 23 Mar 2015, at 21:24, Rubin, Alan <[email protected] > <mailto:[email protected]>> wrote: > > > This works including the reminder for /testfs. > However, the srvstat_mail script seems to run fine but continues and emails > the output every minute. > I am very new to monit so my code will need some improvements. Hopefully you > can help me clean this up. > > Thanks > > -Al > ------------------------------------ > monitrc: > > Global > set alert myemail with reminder on 5 cycles #receive all alerts > > > > check filesystem [/testfs] with path /dev/fslv00 > if space usage > 90% for 1 times within 5 cycles then exec > "/opt/monit/bin/srvstat_mail" > ----------------------------------------------------- > > Script: > > srvstat_mail calls another script > srvstat which is sent to a file > srvstat.out > which I cat contents and email. > > > <image4a3c9c.JPG> > Alan Rubin > Sr. Systems Administrator > Sappi North America > 179 John Roberts Road | South Portland, ME | 04106 > Tel +1 207 854 7443 | Mobile +1 207 347 0978 | Fax +1 > [email protected] <mailto:[email protected]> | www.sappi.com > <http://www.sappi.com/> > Paper is a sustainable and renewable source. Please recycle all printed > documents. Paper informs, inspires and protects. > This message may contain information which is private, privileged or > confidential and is intended solely for the use of the individual or entity > named in the message. If you are not the intended recipient of this message, > please notify the sender thereof and destroy / delete the message. Neither > the sender nor Sappi Limited (including its subsidiaries and associated > companies) shall incur any liability resulting directly or indirectly from > accessing any of the attached files which may contain a virus or the like. > > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general > <https://lists.nongnu.org/mailman/listinfo/monit-general> > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
