monit.conf修正

-# set daemon 120
+ set daemon 60

-# set logfile syslog facility log_daemon
+ set logfile /var/log/monit

-# set mailserver mail.bar.baz, # primary mailserver
+ set mailserver localhost, # primary mailserver

-# set alert sysadm@foo.bar # receive all alerts
+ set alert test@kasagi.homeunix.net not on { # receive all alerts
+ INSTANCE
+ }

-# set httpd port 2812 and
-# use address localhost # only accept connection from localhost
-# allow localhost # allow localhost to connect to the server and
-# allow admin:monit # require user 'admin' with password 'monit'
+ set httpd port 3000 and
+ allow localhost # allow localhost to connect to the server and
+ allow 192.168.1.0/24
+ allow adminid:adminpass # require user 'admin' with password 'monit'

- include /etc/monit.d/*
+ include /etc/monit.d/*.rc

monit.dディレクトリ作成

mkdir /etc/monit.d

mongrel_8000〜mongrel_8004ファイル作成

check process mongrel_8000 with pidfile /var/run/mongrel_cluster/test.8000.pid
group mongrel
start program = "/usr/bin/mongrel_cluster_ctl start --clean"
stop program = "/usr/bin/mongrel_rails stop -p 8000 -P /var/run/mongrel_cluster/test.8000.pid "

if failed host 127.0.0.1 port 8000
protocol HTTP request /friend/list with timeout 5 seconds
then alert