This page was last modified: July 28 2006 16:41:37   
Too Cool for Internet Explorer

Monitor mail activity

A good friend of mine 'Kaptajnen' (The Captain), has provided the basics for this tutorial.

Mailgraph is a tool that provides daily, weekly, monthly and yearly graphs of received/sent and bounced/rejected mail. Mailgraph collects the data from your maillog.

You can see an example of Mailgraph in action here.

Make sure you are logged in as root, then install Mailgraph from your ports collection:

cd /usr/ports/mail/mailgraph/
make install clean distclean

Mailgraph will run as user www and group www by default, but it did not work for me. I therefore changed it to run as user root and group wheel instead:

Open the startup script: /usr/local/etc/rc.d/mailgraph.sh

Locate these lines:

mailgraph_user=${mailgraph_user:-"www"}
mailgraph_group=${mailgraph_group:-"www"}

... change them to ...

mailgraph_user=${mailgraph_user:-"root"}
mailgraph_group=${mailgraph_group:-"wheel"}

... and as always, add Mailgraph to /etc/rc.conf to make sure it is started when system boots.

mailgraph_enable="YES"

After that, fire it up!

/usr/local/etc/rc.d/mailgraph.sh start

If you want to be sure it is actually started:

ps -ax | grep graph

returns something like...
61066 ?? Ss 0:01.02 /usr/bin/perl -w /usr/local/sbin/mailgraph.pl -v --logfile /var/ [...]

You can now point your browser at the cgi script an enjoy :-)

http://your.domain.tld/cgi-bin/mailgraph.cgi