> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:amavis-user-
> [EMAIL PROTECTED] On Behalf Of Matt Herzog
> Sent: Monday, January 08, 2007 10:59 PM
> To: [email protected]
> Subject: [AMaViS-user] amavis-stats
> 
> Despite the project being deader than dirt, I have installed the Debian
> Sarge
> amavis-stats package. I'm not a good enough scripter to hack up
> something from scratch.
> 
> Naturally I have not been able to get it configured properly. For some
> reason
> amavis-stats.php dumps all the png files into /var/cache/amavis-stats
> where it
> then cannot find them! If I copy the file into /var/www/htdocs/img, the
> graphs are visible. How do I get them to be written to /var/www/htdocs/img
> ?
> 

I'd suggest to install newer version of amavis-stats (originally by Mark
Lawrence, since 0.1.14 maintained by Dale Walsh) from
http://osx.topicdesk.com/downloads/

The following procedure is a little step-by-step I wrote for my own
reference for SLES9 based on several web sources and my correspondence with
Dale. You can adjust it for your own system.

Prerequisites: rrdtool, and Getopt::Std Time::localtime Time::Local perl
modules (not sure about the perl modules for that version)


1) Now for Amavis-stats which will generate the data from your mail files
that rrdtools will use:

# tar -zxvf amavis-stats.tar.gz
# cd amavis-stats-0.122

2) Some usable compile options:
  --with-log-file         logfile to read (default=/var/log/amavis.log)
  --with-user=uid         name of the web user (in my case I've used vscan)
  --with-setrgid=uid      if perl supports setrgid (default=no)
  --with-group=gid        name of the web group (default=www)

3)  Lets Install it:
[code]
./configure --enable-id-check --with-log-file=/var/log/amavis.log
--with-user=vscan --with-group=www --prefix=/usr --mandir=/usr/share/man
--localstatedir=/var --sysconfdir=/etc
make
make install
[/code]

Processing web files....
/usr/bin/install -c -o vscan -g vscan -d -m 0775 /var/lib/amavis-stats
/usr/bin/install -c -o vscan -g vscan -d -m 0775 /var/cache/amavis-stats
/usr/bin/install -c -o vscan -g vscan -d -m 0775 /usr/share/amavis-stats
/usr/bin/install -c -o vscan -g vscan -d -m 0775
/usr/share/amavis-stats/includes
/usr/bin/install -c -o vscan -g vscan -d -m 0775
/usr/share/amavis-stats/templates/standard
/usr/bin/install -c -o vscan -g vscan -d -m 0775
/usr/share/amavis-stats/templates/business1/images

4) Insert the following 'include' statement for the amavis-stats.alias.conf
to your /etc/apache2/httpd.conf file:
# Include file for amavis-stats
Include /usr/share/amavis-stats/amavis-stats.alias.conf

apachectl graceful

5) Edit amavis-stats.conf:

I've decided to use mail.info file, cause /var/log/mail.info is a duplicate
of /var/log/mail.
On /var/log/mail I run mailgraph and I've decided to separate this from log
file that amavis-stats scans,
so my $scan_logfile = /var/log/mail.info

# vi /etc/amavis-stats.conf and make sure (uncomment):
$daemon_user    = 'vscan';   # (no default;  customary: wwwrun)
$daemon_group   = 'www';   # (no default;  customary: www)
$scan_logfile           = "/var/log/mail.info";
# $scan_time                    = undef;        # (default is 300 seconds,
which is 5 minutes)

6) Now to test things.

# /usr/sbin/amavis-stats -c /etc/amavis-stats.conf start

Check PID of the process:
# cat /var/lib/amavis-stats/amavis-stats.pid
31413
# ps -ef | grep Amavis
vscan    31413     1  0 17:12 ?        00:00:00 Amavis-Stats

7) After $scan_time (i.e. if it is default it will be after 5 minutes),
you should now have files in the /var/lib/amavis-stats directory similar to
this:

# ls -l /var/lib/amavis-stats
total 334
drwxrwxr-x   2 vscan www    552 Jan  5 17:35 .
drwxr-xr-x  37 root  root  1000 Jan  5 17:29 ..
-rw-r-----   1 vscan www  21692 Jan  5 17:40 1.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 10.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 11.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 12.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 13.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 2.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 3.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 4.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 5.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 6.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 7.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 8.rrd
-rw-r-----   1 vscan www  21692 Jan  5 17:40 9.rrd
-rw-r-----   1 vscan www     67 Jan  5 17:40 amavis-stats.count
-rw-r-----   1 vscan www    248 Jan  5 17:40 amavis-stats.names
-rw-r-----   1 vscan www      6 Jan  5 17:30 amavis-stats.pid
-rw-r-----   1 vscan www    316 Jan  5 17:40 amavis-stats.seen
-rw-r-----   1 vscan www     57 Jan  5 17:40 amavis-stats.state

If the rrd files aren't there one of the above steps wasn't done right.


If someone (like me) installs on a system which defaults to gzip the logs, I
suggest you to modify logrotate conf for the log file in question and either
delete the "compress" directive, or - as I did - add the "delaycompress"
directive. That way logrotate doesn't compress the first rotation, only the
remaining -
8) Make sure you have "delaycompress" option for mail.info rotation config.:

a) Make change to /etc/logrotate.d/syslog so it looks like (i.e. separate
config for /var/log/mail.info):
/var/log/mail /var/log/mail.warn /var/log/mail.err {
    compress
    dateext
    maxage 365
    rotate 99
    missingok
    notifempty
    size +4096k
    create 640 root root
    sharedscripts
    postrotate
        /etc/init.d/syslog reload
    endscript
}

/var/log/mail.info {
    compress
    delaycompress
    dateext
    maxage 365
    rotate 99
    missingok
    notifempty
    size +4096k
    create 640 vscan root
    sharedscripts
    postrotate
        /etc/init.d/syslog reload
    endscript
}

b) If you'd like to use separate amavis.log file be sure to set
in /etc/amavisd.conf:
$DO_SYSLOG = 0;
and $scan_logfile           = "/var/log/amavis.log";
in amavis-stats.conf
and to use this one for /etc/logrotate.d/amavisd-new:
/var/log/amavis.log {
    compress
    dateext
    maxage 365
    rotate 99
    compress
    delaycompress
    size=+4096k
    notifempty
    missingok
    create 644 vscan root
    postrotate
     /etc/init.d/amavis reload
    endscript
}

Or this one I've found on the net:

/var/log/amavis.log {
weekly
compress
delaycompress
create 640 vscan root
postrotate
if [- f /var/spool/amavis/amavisd.pid]; then
of /etc/init.d/amavis restart > /dev/null
fi
endscript
}

But I'm using the first option (a.
-----------------------------------

c) # vi /etc/amavisd.conf
$LOGFILE = "/var/log/amavis.log";
$log_level = 2;              # verbosity 0..5, -d
$log_recip_templ = undef;    # disable by-recipient level-0 log entries
$DO_SYSLOG = 1;              # log via syslogd (preferred)
$syslog_facility = 'mail';   # Syslog facility as a string
           # e.g.: mail, daemon, user, local0, ... local7
$syslog_priority = 'debug';  # Syslog base (minimal) priority as a string,
           # choose from: emerg, alert, crit, err, warning, notice, info,
debug

d) Now we need to make sure amavis-stats will startup on reboot:
Add the following line to /etc/init.d/boot.local (Actually I recommend to
start amavis-stats with "-c /etc/amavis-stats.conf" option, otherwise it
seems that files created in /var/lib/amavis-stats with wrong group ownership
and apache wouldn't read them):
amavis-stats -c /etc/amavis-stats.conf start               


9) To uninstall amavis-stats, simply "rm -rdf" the following:
----------------------------------------------------------
/usr/share/amavis-stats /var/cache/amavis-stats /var/lib/amavis-stats
/usr/sbin/amavis-stats
/usr/doc/amavis-stats.pod /usr/doc/amavis-stats.txt /etc/amavis-stats.conf

> Thanks for any help.
> 
> 
> --
> 
> No folly is more costly than the folly of intolerant idealism.
> 
>  -- Winston Churchill
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> AMaViS-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amavis-user
> AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
> AMaViS-HowTos:http://www.amavis.org/howto/


Regards,
Leon Kolchinsky


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to