You will need to install the following 2 ports:


# cd /usr/ports/net-mgmt/mrtg
# make install clean
# cd /usr/ports/mail/qmailmrtg7
# make install clean


# mkdir /usr/local/www/apache24/data/mrtg
# cd /usr/local/www/apache24/data/mrtg
# fetch http://freebsdrocks.net/files/tarballs/qmailmrtg3.tgz
# tar zxvf qmailmrtg3.tgz
# rm qmailmrtg3.tgz

Run the following commands to start the graphs at 0


# echo " 0" > /tmp/jgrey-found
# echo " 0" > /tmp/pop-found
# echo " 0" > /tmp/rbl-found
# echo " 0" > /tmp/spamd-found
# echo " 0" > /tmp/valid-found

Edit the following files and change the "hostname" to your hostname in each file at the bottom.


# vi mrtg-jgrey
# vi mrtg-pop3
# vi mrtg-rbl
# vi mrtg-spamd
# vi mrtg-valid

Now to set the correct file permissions:


# chmod 755 mrtg-jgrey
# chmod 755 mrtg-pop3
# chmod 755 mrtg-rbl
# chmod 755 mrtg-spamd
# chmod 755 mrtg-valid

Now open up qmailmrtg.cfg and change the WorkDir at the top to the folder where the qmailmrtg will be saved
Change each instance of myhostname to your mailserver name or ip or whatever. Easiest way is to do it like so:

:%s/myhostname/newhostname/g

This is just a find and replace script. What this does is it replaces all instances of myhostname with newhostname

run the following and just make sure you don't have any errors.


# /usr/local/bin/mrtg qmailmrtg.cfg

Now to put the stats in cron:


*/5 * * * * /usr/local/bin/mrtg /usr/local/www/apache24/data/mrtg/qmailmrtg.cfg > /dev/null 2>&1

After about 15-20 minutes you should start seeing graphs.