Guide updated on 29th of February 2016

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network links. MRTG generates HTML pages containing PNG images which provide a LIVE visual representation of this traffic

Qmailmrtg7 takes the smtp and qmail transaction logs and sends them to different mrtg graphs.

aptitude install mrtg zlibc libpng12-dev

cd /downloads/
tar -zxvf qmailmrtg7-4.2.tar.gz
cd /downloads/qmailmrtg7-4.2
make && make install (Ignore compilation warning)

cd /usr/local/bin/
cp /downloads/scripts/courierstats .
mv /usr/local/bin/courierstats /usr/local/bin/
chmod +x /usr/local/bin/

mkdir -p /var/www/mail/mrtg
cd /var/www/mail/mrtg
cp /downloads/scripts/index.mrtg .
sed -i "s/MRTGHOSTNAME/`hostname`/" /var/www/mail/mrtg/index.mrtg
mv /var/www/mail/mrtg/index.mrtg /var/www/mail/mrtg/index.html

cd /etc/
mv /etc/mrtg.cfg /etc/mrtg.cfg.orig
cp /downloads/scripts/qmail.mrtg.cfg .
sed -i "s/MRTGHOSTNAME/`hostname`/" /etc/qmail.mrtg.cfg
mv /etc/qmail.mrtg.cfg /etc/mrtg.cfg

Edit /etc/logrotate.d/rsyslog to rotate courier's log daily:

	rotate 30
		invoke-rc.d rsyslog reload > /dev/null

Point your browser on http://mailadmin.yourdomain.tld/mrtg/ to check your stats (wait 10 minutes before having the first graphs)

Install Roundcubemail

Users comments
Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.