Postfix Spam Filter using Ubuntu Dapper, MailScanner, SpamAssassin, Razor, Pyzor, DCC and ClamAV - Page 5
On this page
4 Mailscanner-MRTG Installation (Optional)
apt-get install mrtg apache2 snmp snmpd libsnmp4.2
Answer "Yes" to debconf MRTG screen.
We won't need that one
First let's backup our default SNMP config. Then create a new one with the correct settings.
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.dist vi /etc/snmp/snmpd.conf
Paste this text into the new snmpd.conf file.
# This line makes the snmp daemon listen only on the loopback interface # If you want to run on an alternative port change the 161 part # (Don't forget to update the mailscanner-mrtg.conf file with the new port agentaddress localhost:161 # Use this version instead for ucd-snmp #agentaddress 161@localhost # This line sets up a single community string (with read-only access) # With access only permitted from localhost # If you have users logging into your machine and want to make sure they # can't easily get info from snmp change 'public' to something else # (Don't forget to update the community string in mailscanner-mrtg.conf) rocommunity public localhost # System Information, change this if you want syslocation YourSysLocation syscontact Support <[email protected]></[email protected]>
To install MailScanner-MRTG, we need to download then install it.
Go to http://sourceforge.net/projects/mailscannermrtg/ and download the latest tarball. At the time of this writing it was 0.10.0
tar xzvf mailscanner-mrtg-0.10.00.tar.gz
Edit the install.pl
Change a couple of options in this script. The following parameters should look like this:
"mrtgcfg" => "/etc/", "www" => "/var/www/", "wwwconf" => "/etc/apache2",
Run the install.pl
We have checked the configuration if install.pl so go ahead and install... When your editor with the mailscanner-mrtg config opens up in your editor, close it, we will edit it later:
Edit the /etc/MailScanner/mailscanner-mrtg.conf, change the following lines:
WWW Root = /var/www/ MTA = postfix MTA Incoming Log = /var/log/mail.log MTA Outgoing Log = /var/log/mail.log MTA Reject Log = /var/log/mail.log Incoming Queue Dir = /var/spool/postfix/hold/ Restart MailScanner = /usr/bin/check_mailscanner MailScanner Log = /var/log/mail.log Outgoing Queue Dir = /var/spool/postfix/deferred/:/var/spool/postfix/defer/ #MailScanner Work Directory = /var/spool/MailScanner/incoming #COMMENT THIS OUT UNLESS IT'S A MOUNTPOINT Spool Directory = /var/spool #COMMENT THIS OUT UNLES IT'S A MOUNTPOINT Use SNMP = yes SNMP Community = public #OR WHATEVER YOU SET IT TO IN SNMPD.CONF
Lets try MailScanner-MRTG, run this two or three times. The first couple of times you should see some erros. If it keeps showing errors there's something wrong:
env LANG=C /usr/bin/mrtg /etc/mailscanner-mrtg.cfg
Add this line into cron to run mrtg every 5 minutes:
0-59/5 * * * * env LANG=C /usr/bin/mrtg /etc/mailscanner-mrtg.cfg 1> /dev/null 2> /dev/null
Ok go to http://spf.example.com/mailscanner-mrtg and let's see if it comes up and the graphs are updating. You should edit out any graphs that don't work by editing the /var/www/mailscanner-mrtg/index.htm file and commenting those graphs out from /etc/mailscanner-mrtg.cfg.