Home /  Monit /  Postfix

This is the configuration I use on ubuntu 9.04

Check that postfix is running, and that it respond. If the process is not running, monit will restart it by default. In case the service was restarted very often and the problem remains, it is possible to disable monitoring using the TIMEOUT statement. This service do not depends on another service.

  check process postfix with pidfile /var/spool/postfix/pid/master.pid
    start program = "/etc/init.d/postfix start"
    stop program  = "/etc/init.d/postfix stop"
    if cpu > 60% for 2 cycles then alert
    if cpu > 80% for 5 cycles then restart
    if totalmem > 200.0 MB for 5 cycles then restart
    if children > 250 then restart
    if loadavg(5min) greater than 10 for 8 cycles then stop
    if failed host INSERT_THE_RELAY_HOST port 25 type tcp protocol smtp
       with timeout 15 seconds
      then alert
    if 3 restarts within 5 cycles then timeout