-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ah thanks! I didn't know about the if succeeded option! Regards
Rowan On 30 May 2011, at 12:46, Martin Pala wrote: > You can implement the same functionality in the script ... when the script is > executed, create some statefile at the end of the script (e.g. using > "/usr/bin/touch /tmp/notification_sent") and make the script skip the > notification if that statefile exists (next time it is executed). You can > embed removal of the statefile on recovery event so the next time the service > recovered and fails again, you'll be notified again. > > Something like this: > > if failed ... then exec "/usr/local/bin/myscript" else if succeeded then > exec "/bin/rm -f /tmp/notification_sent" > > > > > On May 30, 2011, at 1:29 PM, Rowan Wookey wrote: > >> I've tried exec but that sends mails every time monit runs, so if monit runs >> every 5 minutes I'll get 12 emails per hour, is there a way to set exec to >> only run once the same way alerts do? >> >> Regards >> >> Rowan >> >> On 30 May 2011, at 12:26, Martin Pala wrote: >> >>> Hi, >>> >>> you can use "exec" action instead of "alert" to execute custom script which >>> can also send mail (using /usr/bin/mail for example). The script will get >>> information from monit via environment variables, more details here: >>> http://www.mmonit.com/monit/documentation/monit.html#environment >>> >>> Regards, >>> Martin >>> >>> >>> On May 30, 2011, at 1:03 PM, Rowan Wookey wrote: >>> >>>> Hi, >>>> >>>> Does anyone know if it's possible to have the output of a shell script >>>> appear in a monit alert. I've tried adding this >>>> >>>> set alert root@localhost with mail-format { >>>> message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. >>>> Yours sincerely, >>>> monit >>>> `free -m` >>>> } >>>> >>>> >>>> But that doesn't execute the `free -m` >>>> >>>> Regards >>>> >>>> Rowan >>>> -- >>>> To unsubscribe: >>>> https://lists.nongnu.org/mailman/listinfo/monit-general >>> >>> >>> -- >>> To unsubscribe: >>> https://lists.nongnu.org/mailman/listinfo/monit-general >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG/MacGPG2 v2.0.17 (Darwin) >> Comment: GPGTools - http://gpgtools.org >> >> iEYEARECAAYFAk3jf5IACgkQ0AJ/wLYi/EKdWwCfaDIcULcChFkOuZuF7w1R7DQv >> UNkAnj5kcAjYmZpIpaObFEYeZO6qQ3bz >> =XDvL >> -----END PGP SIGNATURE----- >> >> -- >> To unsubscribe: >> https://lists.nongnu.org/mailman/listinfo/monit-general > > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAk3jh98ACgkQ0AJ/wLYi/EJh5wCgiR4FQXJd9DnFPljyfpB1jwHE aaIAn1f5FLFd8g6hQ6FzrE8uQbGfZBv4 =BEC1 -----END PGP SIGNATURE----- -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
