Always keep Amavis running by using Monit

1. apt-get install monit

2. Add "include /etc/monit/conf.d/*" to the end of the /etc/monit/monitrc

3. mkdir -p /etc/monit/conf.d

4. edit /etc/default/monit, uncomment startup=1

5. Create /etc/monit/conf.d/amavisd-new

With the following contents:

   check process amavisd with pidfile /var/run/amavis/amavisd.pid
     group mail
     start program = "/etc/init.d/amavis start"
     stop  program = "/etc/init.d/amavis stop"
     if failed port 10024 protocol smtp then restart
     if 5 restarts within 5 cycles then timeout
     depends on amavisd_bin
     depends on amavisd_rc

   check file amavisd_bin with path /usr/sbin/amavisd-new
     group mail
     if failed checksum then unmonitor
     if failed permission 755 then unmonitor
     if failed uid root then unmonitor
     if failed gid root then unmonitor

   check file amavisd_rc with path /etc/init.d/amavis
     group mail
     if failed checksum then unmonitor
     if failed permission 755 then unmonitor
     if failed uid root then unmonitor
     if failed gid root then unmonitor

6. Make sure that your $max_server variable in /etc/amavis/conf.d/99-dtc, is higher than the entry in /etc/postfix/master.cf.

Ie, in /etc/amavis/conf.d/99-dtc you have:

$max_servers=4;

Therefore in /etc/postfix/master.cf, you must have:

smtp-amavis unix - - - - 3 smtp

7. /etc/init.d/monit restart

I imagine we can do the same for the rest of our services that we run on a typical installation. This will give us a more robust solution no ? :)

Editing this page means accepting its license.

Page last modified on January 22, 2008, at 08:41 AM EST