Monit is one of my favorite tools. While it is a nice monitoring tool
for politely behaved services, it is also a quick work-around for
those services which don't play well in the normal boot sequence. For
me, these include the Statusnet daemons and Openfire. I have no good
startup script for the Statusnet daemons (xmppdaemon and queuedaemon)
and Openfire absolutely refuses to be part of the normal boot
sequence, though manually running "/etc/init.d/openfire start" always
works. In any case, the following monit recipies work for me:
check process xmppdaemon with pidfile /var/run/xmppdaemon.generic.pid
group statusnet
start program = "/var/www/sn/scripts/startdaemons.sh"
stop program = "/var/www/sn/scripts/stopdaemons.sh"
if 5 restarts within 5 cycles then timeout
# queuedaemon
check process queuedaemon with pidfile /var/run/queuedaemon.generic.pid
group statusnet
start program = "/var/www/sn/scripts/startdaemons.sh"
stop program = "/var/www/sn/scripts/stopdaemons.sh"
if 5 restarts within 5 cycles then timeout
# openfire
check process openfire with pidfile /var/run/openfire.pid
group openfire
start program = "/etc/init.d/openfire start"
stop program = "/etc/init.d/openfire stop"
if failed host localhost port 9090
protocol HTTP request "/login.jsp" then restart
if 5 restarts within 5 cycles then timeout The only shortcoming I see with the tool is that alerts are limited to
email only. I'd love to have the ability to post alerts via StatusNet
or IM/IRC. Guess I need to brush up on my C (or borrow someone else's
code). I know of a very cheesy system call that will post alerts to
Statusnet.