fusionictnl
Verified User
BIG! Howto for MailGraph: http://www.stat.ee.ethz.ch/mailgraph.cgi
There are issues at the moment with mailgraph and parsing the exim logfiles. I'll be on a vacation for a couple of weeks. After it i'll try to resolve the issues. If you'll follow the howto completly, the issues with "Useless use of string.... " are resolved. The only left issue is parsing the exim logs
First we need to have to fix 2 dependecies: RRDTool (if you already have it skip it) and File::Tail (which requires Time::HiRes):
* CPAN modules:
- perl -MCPAN -e shell (First time running, keep pressing enter or make your selection
until "cpan>")
cpan> install File::Spec
cpan> install Time::HiRes (Could give errors ignore)
cpan> install File::Tail (Could give errors ignore)
cpan> install Date::Calc (Could give errors ignore)
quit
* RRDTool needs Freetype2 (if you don't have it follow instructions below)
- cd /usr/tmp
- wget http://surfnet.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz
- tar zxvf freetype-2.3.7.tar.gz
- cd freetype-x-x-x
- ./configure
- make
- make install
* RRDTool also needs LibART (if you don't have it follow instructions below)
- cd /usr/tmp
- wget ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/libart_lgpl-2.3.20.tar.gz
- tar zxvf libart_lgpl-*.tar.gz
- cd libart_lgpl-x-x-x
- ./configure
- make
- make install
* Now we need RRDTool
:
- cd /usr/tmp
- wget ftp://ftp.bit.nl/mirror/rrdtool/rrdtool.tar.gz
- tar zxvf rrdtool.tar.gz
- cd rrdtool-x.xx.x
* Ok first determine where freetype and libart is located (if it is in /usr/include/freetype2 do nothing) and run following command:
- export CPPFLAGS="-I[PATH FREETYPE2] -I [PATH LIBART]"
In my case: - export CPPFLAGS="-I/usr/local/include/freetype2 -I/usr/local/include/libart-2.0"
- ./configure (Laugh when notice appears on the end
)
- make (Some nice errors could flow over you're screen)
- make install
* I never liked dirs with version numbers on my system so fix the rrdtool dir:
- mv /usr/local/rrdtool-x-x-xx /usr/local/rrdtool
* A lot nicer!
* Download the MailGraph package:
- cd /usr/tmp
- wget http://mailgraph.schweikert.ch/pub/mailgraph-1.14.tar.gz
- tar zxvf mailgraph-exim.tar.gz
- cd mailgraph
* Edit mailgraph.cgi and mailgraph.pl
* Add after comments and after first "use" statements: use lib qw( /usr/local/rrdtool/lib/perl);
# locate librrd.so.2
# ln -s /usr/local/rrdtool/lib/librrd.so.2 /usr/lib/librrd.so.2
Where you'll put in the correct location.
Do the same for libart_lgpl_2.so.2
# locate libart_lgpl_2.so.2
# ln -s /usr/local/lib/libart_lgpl_2.so.2 /usr/lib/libart_lgpl_2.so.2
* Fire it up from shell:
- ./mailgraph.cgi
* Still getting Time/HiRes Errors ?? Manual installation of perl package:
- cd /usr/tmp
- wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.65.tar.gz
- tar zxvf Time-HiRes-1.65.tar.gz
- cd Time-HiRes-1.65
- perl Makefile.pl
- export LC_ALL=C
- make
- make test
- make install
* Now all should be fine
* Move it to it's original destination
- mv /usr/tmp/mailgraph /usr/local/mailgraph
* edit the mailgraph-init
* CHANGE: MAILGRAPH_PL=/usr/local/mailgraph/mailgraph.pl (Like that)
* CHANGE: MAILLOG=[you log location normaly /var/log/exim/mainlog]
* CHANGE: RRD_DIR=/var/lib/mailgraph
* Change whatever you like to be different, but the RRD_DIR is hardcoded in the cgi (so you will have to change that too)
*
* edit mailgraph.cgi and change the temp_dir to ex. /tmp
- mkdir /var/lib/mailgraph
* Fire it up:
- sh mailgraph-init start
- ps aux | grep mailgraph (should show up perl -w /usr/local/mailgraph....)
* Ok it now monitors you're maillog for changes and writes the changes to /var/lib what's set in the init script
* Let's set it up on one of you domains:
- cp /usr/local/mailgraph/mailgraph.cgi /home/[user]/domains/[domain]/public_html/cgi-bin/mailgraph.cgi
* Go and test it http://domain/cgi-bin/mailgraph.cgi
* No images ?? (check if you did everything as described and check you're apache error_log)
OK and to enable VIRUS to be calculated with it, change you're deny message to begin with MALWARE
Let me know if it worked
There are issues at the moment with mailgraph and parsing the exim logfiles. I'll be on a vacation for a couple of weeks. After it i'll try to resolve the issues. If you'll follow the howto completly, the issues with "Useless use of string.... " are resolved. The only left issue is parsing the exim logs
First we need to have to fix 2 dependecies: RRDTool (if you already have it skip it) and File::Tail (which requires Time::HiRes):
* CPAN modules:
- perl -MCPAN -e shell (First time running, keep pressing enter or make your selection

cpan> install File::Spec
cpan> install Time::HiRes (Could give errors ignore)
cpan> install File::Tail (Could give errors ignore)
cpan> install Date::Calc (Could give errors ignore)
quit
* RRDTool needs Freetype2 (if you don't have it follow instructions below)
- cd /usr/tmp
- wget http://surfnet.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz
- tar zxvf freetype-2.3.7.tar.gz
- cd freetype-x-x-x
- ./configure
- make
- make install
* RRDTool also needs LibART (if you don't have it follow instructions below)
- cd /usr/tmp
- wget ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/libart_lgpl-2.3.20.tar.gz
- tar zxvf libart_lgpl-*.tar.gz
- cd libart_lgpl-x-x-x
- ./configure
- make
- make install
* Now we need RRDTool

- cd /usr/tmp
- wget ftp://ftp.bit.nl/mirror/rrdtool/rrdtool.tar.gz
- tar zxvf rrdtool.tar.gz
- cd rrdtool-x.xx.x
* Ok first determine where freetype and libart is located (if it is in /usr/include/freetype2 do nothing) and run following command:
- export CPPFLAGS="-I[PATH FREETYPE2] -I [PATH LIBART]"
In my case: - export CPPFLAGS="-I/usr/local/include/freetype2 -I/usr/local/include/libart-2.0"
- ./configure (Laugh when notice appears on the end

- make (Some nice errors could flow over you're screen)
- make install
* I never liked dirs with version numbers on my system so fix the rrdtool dir:
- mv /usr/local/rrdtool-x-x-xx /usr/local/rrdtool
* A lot nicer!
* Download the MailGraph package:
- cd /usr/tmp
- wget http://mailgraph.schweikert.ch/pub/mailgraph-1.14.tar.gz
- tar zxvf mailgraph-exim.tar.gz
- cd mailgraph
* Edit mailgraph.cgi and mailgraph.pl
* Add after comments and after first "use" statements: use lib qw( /usr/local/rrdtool/lib/perl);
# locate librrd.so.2
# ln -s /usr/local/rrdtool/lib/librrd.so.2 /usr/lib/librrd.so.2
Where you'll put in the correct location.
Do the same for libart_lgpl_2.so.2
# locate libart_lgpl_2.so.2
# ln -s /usr/local/lib/libart_lgpl_2.so.2 /usr/lib/libart_lgpl_2.so.2
* Fire it up from shell:
- ./mailgraph.cgi
* Still getting Time/HiRes Errors ?? Manual installation of perl package:
- cd /usr/tmp
- wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.65.tar.gz
- tar zxvf Time-HiRes-1.65.tar.gz
- cd Time-HiRes-1.65
- perl Makefile.pl
- export LC_ALL=C
- make
- make test
- make install
* Now all should be fine
* Move it to it's original destination
- mv /usr/tmp/mailgraph /usr/local/mailgraph
* edit the mailgraph-init
* CHANGE: MAILGRAPH_PL=/usr/local/mailgraph/mailgraph.pl (Like that)
* CHANGE: MAILLOG=[you log location normaly /var/log/exim/mainlog]
* CHANGE: RRD_DIR=/var/lib/mailgraph
* Change whatever you like to be different, but the RRD_DIR is hardcoded in the cgi (so you will have to change that too)
*
* edit mailgraph.cgi and change the temp_dir to ex. /tmp
- mkdir /var/lib/mailgraph
* Fire it up:
- sh mailgraph-init start
- ps aux | grep mailgraph (should show up perl -w /usr/local/mailgraph....)
* Ok it now monitors you're maillog for changes and writes the changes to /var/lib what's set in the init script
* Let's set it up on one of you domains:
- cp /usr/local/mailgraph/mailgraph.cgi /home/[user]/domains/[domain]/public_html/cgi-bin/mailgraph.cgi
* Go and test it http://domain/cgi-bin/mailgraph.cgi
* No images ?? (check if you did everything as described and check you're apache error_log)
OK and to enable VIRUS to be calculated with it, change you're deny message to begin with MALWARE
Let me know if it worked

Last edited: