Setting up alerts in Proxmox is critical to making sure you are notified if something goes wrong with your servers. It’s so easy, I should have done this years ago! In this tutorial, we’ll set up email notifications using SMTP with Gmail or G Suite that send email alerts when there are disk errors, ZSF Issues, or when backup jobs run. We’ll then test the alerts to make sure they are working by yoinking a drive from my ZFS pool (and hopefully it doesn’t fail).
install dependencies –
apt update
apt install -y libsasl2-modules mailutilsConfigure app passwords on your Google account
https://myaccount.google.com/apppasswords
Configure postfix
echo "smtp.gmail.com [email protected]:YourAppPassword" > /etc/postfix/sasl_passwdupdate permissions
chmod 600 /etc/postfix/sasl_passwdhash the file
postmap hash:/etc/postfix/sasl_passwdcheck to be sure the db file was created
cat /etc/postfix/sasl_passwd.dbedit postfix config
nano /etc/postfix/main.cf# google mail configuration
relayhost = smtp.gmail.com:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600sreload postfix
postfix reloadsend a test email
echo "This is a test message sent from postfix on my Proxmox Server" | mail -s "Test Email from Proxmox" [email protected]edit name in email
install dependency
apt update
apt install postfix-pcreedit config
nano /etc/postfix/smtp_header_checksadd the following text
/^From:.*/ REPLACE From: pve1-alert <[email protected]>hash the file
postmap hash:/etc/postfix/smtp_header_checkscheck the contents of the file
cat /etc/postfix/smtp_header_checks.dbadd the module to our postfix config
nano /etc/postfix/main.cfadd the following to the end of the file
smtp_header_checks = pcre:/etc/postfix/smtp_header_checksreload postfix service
postfix reload