Cacti monitoring of Postfix and Amavisd-new
It’s been a while since I’ve dived into Cacti, but back then I got frustrated at the lack of ability to monitor Postfix mail transportation and Amavisd filtering. I wanted it both for the practical results (know when you have an exceeding mail load, know when you have a spam attack…), and both for the show-off in it.
I wasn’t very happy then, but today I’ve managed to activate such monitoring, thanks to this link. Note I’m linking to the 2nd page. Use the first page to aquire the required Cacti template, and use the modified script in page 2 to monitor both Amavisd and Postfix.
A note – Use the script in the 2nd page even if you don’t use Amavisd. If you do use it, note the changes required in the /etc/amavisd.conf file (in my case, at least). Note that you should cancel the directive, if existing: "$log_recip_templ = undef;", so logging would be correct. Also note that you need to redirect amavisd logs to the same logs as postfix uses – in my case /var/log/maillog.
Further on with this subject – I used to redirect amavisd to a different loggin facility: "$SYSLOG_LEVEL = ‘local6.debug’;" , so I could catch the log directly from local6. In my /etc/syslog.conf I have the following directive so my logs are redirected to the right file:
mail.*;local6.* -/var/log/maillog
I’ve seperated certain log functions using the "localX" logging facility to better control the log data obtained on a loaded production server.