Skip to content

Instantly share code, notes, and snippets.

@eksiscloud
Created April 22, 2020 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eksiscloud/af8edac99749a7bb70f045afc60bdfa3 to your computer and use it in GitHub Desktop.
Save eksiscloud/af8edac99749a7bb70f045afc60bdfa3 to your computer and use it in GitHub Desktop.
Monit: Postfix
# Postfix
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group mail
start program = "/etc/init.d/postfix start"
stop program = "/etc/init.d/postfix stop"
if failed host YOUR-RELAY-HOST port 587
type tcp protocol smtp using tls
with timeout 15 seconds
then alert
if 3 restarts within 5 cycles then timeout
depends on postfix_rc
depend postdrop_bin
depend postqueue_bin
depend master_cf
depend main_cf
check file postfix_rc with path /etc/init.d/postfix
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 postdrop_bin with path /usr/sbin/postdrop
group mail
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor
check file postqueue_bin with path /usr/sbin/postqueue
group mail
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor
check file master_cf with path /etc/postfix/master.cf
group mail
include /etc/monit/templates/rootrc
check file main_cf with path /etc/postfix/main.cf
group postfix
include /etc/monit/templates/rootrc
@eksiscloud
Copy link
Author

YOUR-RELAY-HOST is that service who will deliver emails of a server, like Amazon SES, Gmail or Mailgun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment