I wrote a monit.d file for mongrels which works in this version:
check process redmine with pidfile /home/redmine/service/redmine.pid group webservice start program = "/usr/bin/mongrel_rails start -p 41328 -e production -d --pid /home/redmine/service/redmine.pid --user redmine --group redmine -a 127.0.0.1 -c /home/redmine/app" stop program = "/usr/bin/mongrel_rails stop --pid /home/redmine/service/redmine.pid -c /home/redmine/app && rm /home/redmine/service/redmine.pid > /dev/null 2>&1" if cpu greater 50% for 2 cycles then alert if cpu greater 80% for 3 cycles then restart if totalmem greater 60.0 MB for 5 cycles then restart if loadavg (5min) greater 4 for 8 cycles then restart if 3 restarts within 5 cycles then timeout $ Checking monit control file syntax... $ Control file syntax OK
I want to also monitor the http response, so I add this line at the end:
if failed port 41328 protocol http with timeout 10 seconds then restart
Now monit complains:
$ Checking monit control file syntax... $ /etc/monit.d/redmine:16: Error: exceeded maximum number of program arguments 'http' $ ERROR: CHECK MONIT CONFIG FILE SYNTAX
How do I correctly monitor the port?
EDIT: I found my mistake at last: I accidently did not put the closing quotes at the end of the "stop program" line above. I now corrected it in the question and also on my server.