I was recently trying to do some tricky start and stop commands with Monit http://mmonit.com/monit/. Unfortunately while Monit itself can log to syslog, it doesn't output anything from attempts to start and stop the applications.
The stripped down environment that Monit spawns can be problematic and getting it to cough up whats wrong can be frustrating.
Based off of an answer to a similar question on stack overflow http://stackoverflow.com/questions/3356476/debugging-monit by billitch I think I came up with a good way to keep tabs on whats happening inside those Monit start and stop commands. A wrapper script pipes both standard output and error to syslog.
I created two shell scripts in /etc/monit, one for full debugging, and one for minimal extra output and ongoing use just in case a problem crops up, you can check your syslog and see what bad thing went down.
My original scripts also preserved the exit code of the command under test but apparently Monit doesn't give a whit about what the command exited as; so I've presented the simpler script here.
This is an example Monit script, showing execution of both scripts.
check process dk-filter with pidfile /var/run/dk-filter/dk-filter.pid group mail start program = "/etc/monit/modebug /etc/init.d/dk-filter start" stop program = "/etc/monit/morun /etc/init.d/dk-filter stop" if 5 restarts within 5 cycles then timeout if failed unixsocket /var/run/dk-filter/dk-filter.sock then restarter.sock then restart