Monitor ClamAv and Amavis with MRTG

 

Contributed by:

Jesper Knudsen

Created/Updated: 09-02-2004

 


If you want to monitor how many e-mails are infected with virus you can use MRTG (which I love). First install MRTG as mentioned in the guide. You need to place two statistics gathering "programs" in your /etc/mrtg directory. An example of AntiVirus MRTG statistics can be seen here.

 

[root@e-smith]# cd /etc/mrtg

[root@e-smith]# wget http://sme.swerts-knudsen.dk/downloads/MRTG/virusstats.pl

[root@e-smith]# wget http://sme.swerts-knudsen.dk/downloads/MRTG/virus-stats

[root@e-smith]# chmod 755 virusstats.pl

[root@e-smith]# chmod 755 virus-stats

 

 

if you want to use my AntiVirus MRTG config file then also download that

 

[root@e-smith]# wget http://sme.swerts-knudsen.dk/downloads/MRTG/virus.cfg

 

You now need to create the output directory where MRTG will place result data. This directory is configured in the virus.cfg file and in my case /home/e-smith/files/ibays/mrtg/virus

 

[root@e-smith]# mkdir /home/e-smith/files/ibays/mrtg/html/virus

 

You should now be able to run MRTG (notice that you get warnings in the first two runs)

 

[root@e-smith]# mrtg virus.cfg

 

You would properly like to have this added to your existing MRTG cron job so add a line in the all-ip file (also located in /etc/mrtg)

[root@e-smith ]# pico all-ip

Insert the following line in the bottom and press CTRL-X, Y, to save:

/usr/bin/mrtg /etc/mrtg/virus.cfg;

If you want to verify that you get data from your log files you can run both programs (virus-stats and virusstats.pl) from the command line.

ex.

[root@e-smith ]# ./virus-stats

virus: 4
clean: 19
processed: 23

[root@e-smith ]# ./virusstats.pl localhost virus

4
23