sa-exim-stats INSTALL file What you need : - PHP version > 4.30 (build as a CLI executable) - Exim MTA patched with sa-exim (tested with version 3.0) - Mail::SpamAssassin perl module (tested with version 2.53) Optional: - RRDTool - MySQL --- PHP PHP should be build as a CLI SAPI module. You can see how your binary is build by typing 'php -v' at the command prompt. The binary can either be build as a CGI or CLI module. The most important difference is that with the CLI the PHP headers are no longer displayed as php is called, and the argv and argc variables are automaticaly registered. For more information and building instructions see http://www.php.net/manual/en/features.commandline.php --- Exim You need a version of Exim that is patched with sa-exim. sa-exim is a patch for Exim, written by Marc Merlin, that scans messages at SMTP time. You can find it at http://marc.merlins.org/linux/exim/sa.html --- Mail::Spamassassin SpamAssassin is a program that that scans emails and marks them as spam/nonspam. See http://www.spamassassin.org for installation instructions. --- sa-exim-stats sa-exim-stats is a logparser for logfiles generated by the above mentioned configuration of sa-exim + spamassassin. It is written in PHP so it needs a php executable (preferably the CLI version, see above). If you get a error like the following : bash: /usr/bin/sa-exim-stats: bad interpreter: No such file or directory You have have to change the first line of the file, and point it to the location you php binary is installed, '#!/usr/local/bin/php' for example. See the README file for a list of commandline options. --- MySQL Using MySQL instead of saving to a file (recommanded): Create a user in MySQL for the sa-exim-stats database. Create the database and import the table structure into it: #mysqladmin -u sa-exim-user -p create sa-exim-stats Enter password : sa-exim-pass #mysql -u sa-exim-user -p sa-exim-stats < sa-exim-stats.sql Enter password : sa-exim-pass Open the script file and edit the MySQL parameters (username, pass etc.) --- RRD Tool If you want to use RRDTool to graph spam stats, you must set the appropriate variables inside the scriptfile. Make sure the user that runs the script has read/write access to the specified file/directory. Put the following line in your crontab: */5 * * * * user /php /sa-exim-stats -rrd > /dev/null 2>&1 You can doe a '#sa-exim-stats -rebuild' to create the RRD archive and fill it with data from the logfile. Make sure you do this as the user you put in the crontab (disable the crontab entry while rebuilding the rrd, you will get errors if you rebuild and let crontab update at the same time !!!). If the file is created by another user, you will have to change the permissions on the created .rrd file so the crontab user can write to the file. When '-rebuild continue' is used, the .rrd archive won't be deleted and rebuild from scratch. This can be used to import a second logfile. The second logfile will be appended to the already existing .rrd archive. When there is an overlapping time block (5 minutes) in the two logfiles you will see some errors, and the values from the first logfile are used. The logfiles have to be imported in chronological order.