Given a config like this:
check host web1 address web1
if failed host web1 port 80 protocol http
then exec "/usr/local/bin/failover.sh -h web2"
Can I detect if web1 has returned from failed state, and perform a "fail back" action?
If I were just to detect if it was up, then I would be running the failover command every daemon seconds, and I don't want to do that if I don't have to; it would provide needless log entries and alerts.
Thanks to Eric Pailleau for his suggestion which lead to a working answer:
It's odd, but if you call /bin/bash on succeeded, monit doesn't seem to run the command. I suspect it thinks it has run the command already, so doesn't bother. It doesn't seem to mind running the first command over and over however!