Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We only want to be alerted if the service fails to restart. Is this possible?

That is if, on the first check the service is down then restart it and don't bother to send us an alert; but if the service is still down after two cycles then we want to know.

Tried if not exist for 2 cycles then alert but found that whilst we'd get an alert it would not try to restart.

So then tried the below but same result: sends an alert without attempting a restart.

check process mysql with pidfile /var/run/mysqld/
   start program = "/etc/init.d/mysql start"
   stop program = "/etc/init.d/mysql stop"
   if not exist then restart
   if not exist for 2 cycles then alert

Can we set it to only send the alert when pain persists?

share|improve this question

I'd try the Monit mailing list for specifics, or see if you can rework the logic to get the right effect. See my answer here for use of the noalert directive:

Suppress Monit message 'Monit instance changed' on stop/start

You may be able to add no alert under the action or check that you're trying to suppress.

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.