Monitoring
MRTG is a Perl program designed for monitoring network routers etc but it can actually monitor anything which will provide regular data in a specific format. Mailscanner-mrtg is a program which can do just that. Between them they write a set of web pages which can be used to see how the system is performing.
Install Apache:
cd /usr/ports/www/apache13 make install cd /usr/local/etc/apache edit httpd.conf
change ServerAdmin to point to a "real" email address - eg webmaster@cnwl.ac.uk
To make Apache auto-start, edit /etc/rc.conf and add
apache_enable="YES"
Now install mailscannermrtg
cd /usr/ports/mail/mailscanner-mrtg make install cd /usr/local/etc/mailscanner-mrtg cp mailscanner-mrtg.cfg.sample mailscanner-mrtg.cfg cp mailscanner-mrtg.conf.sample mailscanner-mrtg.conf edit mailscanner-mrtg.conf
change:
MTA = postfix Incoming Queue Dir = /var/spool/postfix/hold/ Outgoing Queue Dir = /var/spool/postfix/incoming/ MailScanner Work Directory = /var # note that this and the one below Spool Directory = /var # is actually the mount point; not the directory interfaces to monitor = fxp0, fxp1 #this depends on your network interfaces!
edit /usr/local/etc/MailScanner/MailScanner.conf
log spam = yes
Assuming that you're only going to use Apache for this then change httpd.conf as shown in the script - add:
<VirtualHost *:80> ServerAdmin postmaster@cnwl.ac.uk DocumentRoot /usr/local/www/mailscanner-mrtg Alias /mailscanner-mrtg "/usr/local/www/mailscanner-mrtg/" </VirtualHost>
Run the following command and browse to http://<servername> and you should see the first set of stats (you will get some errors the first time - it tries to delete old files etc which aren't yet there; after it's been run a few times all the errors will go.
/usr/local/bin/mrtg /usr/local/etc/mailscanner-mrtg/mailscanner-mrtg.cfg
