Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

The correct instruction would be:

if failed port 41328 protocol http then restart

The with timeout 10 seconds applies when starting a program to create a failure after timeout.

share|improve this answer
    
jneves thank you for your answer. In the end I could not confirm your information from the behaviour of monit. After I corrected my other error my original directive was accepted and also shows on the status page like this: "If failed localhost:41328 [HTTP via TCP] with timeout 10 seconds 1 times within 1 cycle(s) then restart else if passed 1 times within 1 cycle(s) then alert" –  user12096 May 3 '10 at 16:41
up vote 0 down vote accepted

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.

Now also the port line works without change:

if failed port 41328 protocol http with timeout 10 seconds then restart
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.