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.

Monit seems to give up restarting a service if it fails a few times, and unmonitors it. I can't find anything in the documentation about the specifics of when or why. In my environment, I want it to keep trying on its poll intervals indefinitely. Is there any way to configure monit to never stop monitoring a service, even if it doesn't start up successfully?

share|improve this question
Please post a sample of your monit config. –  ewwhite Sep 20 '11 at 17:47
gist.github.com/1229828 -- I removed some mail server/alert stuff and the HTTP server configuration from monitrc. The other file is an example of our service configuration. Note the lack of "if x restarts then timeout" clause in it. –  Joe Shaw Sep 20 '11 at 18:10
I've wondered about this myself. Sometimes I just kill something to test what monit does and monit just unmonitors it. –  Ramon Tayag Nov 7 '11 at 2:31

3 Answers 3

I would simply use a cron job that would run monit start servicename at the desired intervals. Of course, you can use groups for a finer control.

share|improve this answer
This is exactly what I ended up doing, but I'm not too happy about it. –  Joe Shaw Mar 1 '12 at 2:44

Based on your Monit code snippet, it looks like you have to modify or add cycle statements to your process stanza. See the relevant documentation here and here.

It seems like you may want to set your service tests to execute every cycle with no timeout statement. Also look at your monit homepage at http://hostname:2812. Check the page for the relevant service and look at the "Existence" field. Your default should look like:

If doesn't exist 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert

share|improve this answer
Looking at the monit page for the service, existence field is set to that. But the rule just doesn't seem to be obeyed. With a service that is designed to fail (ie, just a shell script that echoes out the date and does exit 1) it still unmonitors quickly. If I use "monit monitor joe-test" it stops monitoring after one failure. With "monit start joe-test" it gives up after 2 tries. –  Joe Shaw Sep 23 '11 at 15:49
just take out the if 5 restarts within 5 cycles then timeout then monit system will not unmonitor it. –  user177346 Jun 11 '13 at 5:13

I had the exact same issue where despite restarting monit, it would refuse to monitor after the timeout. Finally figured out had to delete the monit state file (/var/.monit.state) and restart monit to make it monitor all programs again.

share|improve this answer

Your Answer


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.