On Thu, 2013-01-24 at 11:33 +0000, Nick Upson wrote: > sorry I didn't go into sufficient detail, I do have exec alerts > switched off as I don't want them for other areas of the > configuration, so I have to explicitly define where I do want them
Then I think you want something like this: check device opt with path /opt if space usage > 99% then exec "/bin/bash -c '/usr/bin/monit stop database'" alert "[email protected]" on { exec } Not 100% on the syntax, but that's the general principle. It will enable an alert on this specific check for the exec event. As far as I'm aware, it will be in addition to, not instead of, any global alerts. In other words, you should get all your usual alerts *plus* exec. But you may want to check that to be sure. Depending on how many exec events you're suppressing, it might be easier to suppress them per service. That's what I do in a couple of cases where I'm using monit to reduce directory sizes by calling a cleanup script. I have something like: check device foo with path /foo/bar if spaec usage > 90% then exec "/foo/bar/cleanup.sh" alert "[email protected]" but not on { exec } Where [email protected] is my global alert email address. Cheers - Callum. > On 24 January 2013 11:30, Callum Macdonald > <[email protected]> wrote: > Is there anything in your global config that prevents alerts > on exec? > > Do you get other emails from monit? > > I get alerts every time monit performs any action, as is the > default > according to my reading of the man page: > http://mmonit.com/monit/documentation/monit.html#alert_messages > > For example: > > SET ALERT [email protected] NOT exec > > Would stop [email protected] from getting exec alerts. Likewise a > similar > local alert statement would do the same. But short of > something like > that, emails should be generated when an exec event happens. > > Cheers - Callum. > > On Thu, 2013-01-24 at 10:55 +0000, Nick Upson wrote: > > I had a system trip this today and not send a alert from > monit, which > > is why this have become relevant > > > > > > > > On 24 January 2013 10:53, Callum Macdonald > > <[email protected]> wrote: > > I believe the alert is redundant, you'll get an > alert on the > > exec action > > anyway, unless you've explicitly suppressed it > somewhere. In > > which case, > > you could reactivate it with a local alert > statement. - C > > > > On Thu, 2013-01-24 at 10:43 +0000, Nick Upson wrote: > > > > > > check device opt with path /opt > > > if space usage > 99% then > > > exec "/bin/bash -c '/usr/bin/monit stop > database'" > > > if space usage > 99% then > > > > > > alert > > > > > > > > > It would be cleaner to write > > > > > > check device opt with path /opt > > > if space usage > 99% then > > > exec "/bin/bash -c '/usr/bin/monit stop > database'" > > > alert > > > > > > > > > but that is rejected Error: syntax error 'if' > > > > > > -- > > > Nick Upson, Telensa Ltd > > > > > > > > -- > > > To unsubscribe: > > > > https://lists.nongnu.org/mailman/listinfo/monit-general > > > > > > > > -- > > To unsubscribe: > > > https://lists.nongnu.org/mailman/listinfo/monit-general > > > > > > > > -- > > Nick Upson, Telensa Ltd > > > > -- > > To unsubscribe: > > https://lists.nongnu.org/mailman/listinfo/monit-general > > > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general > > > > > -- > Nick Upson, Telensa Ltd > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
