Juan,

> > On a restart all databases in /var/amavisd/db/ are created afresh,
> > so amavisd-agent reports data from the last amavisd start,
>
> Thanks for your answers Mark.
>
> Having the potential to lose all db info due to unforeseen problems is
> worrying.  Are there any plans to somehow keep that information
> persistent?

Actually this was the way it worked when initially introduced.
The code is still there so a change to revert back is trivial:

--- amavisd~    2008-06-20 12:03:53.000000000 +0200
+++ amavisd     2008-06-30 03:15:49.000000000 +0200
@@ -8756,6 +8756,6 @@
       elsif (!-d _) { die "db_home is not a directory : $name" }
       elsif (!-w _) { die "db_home directory is not writable: $name" }
-    # Amavis::DB::init(1, 15+1+40);  # SHA-1
-      Amavis::DB::init(1, 15+1+32);  # MD5
+    # Amavis::DB::init(0, 15+1+40);  # SHA-1
+      Amavis::DB::init(0, 15+1+32);  # MD5
     }
     if (!defined($sql_quarantine_chunksize_max)) {

The change only avoids deleting database files on a restart.

I introduced the deletion of database files on startup because
some people (with some older versions of bdb) were experiencing
db lockups or corruption, from which even amavisd restart would
not help - requiring a manual database recovery or deletion of
database file(s). Myself I never experienced such a problem.

> I'm trying to think how to capture those stats.  Cron job with text
> manipulation shell script I guess.

The database used for counters is a simple key/value database,
containing name of a counter as a key, and an integer (ascii
decimal representation) for its value (along with a data type,
a counter or a gauge type (or an oid)).

It is expected that other more versatile utilities (like a proper
SNMP agent) would access this database directly. The amavisd-agent
was intented only as a simple demo program to show how to reliably
access a database, with fine record read-locking granularity as
available in a Berkeley db and dealing with interrupts, making sure
the database does not remain locked even if the program is manually
aborted. It is probably more difficult to parse the output of
amavisd-agent than to access the database directly.
Try:  db_dump -p /var/amavis/db/snmp.db 

Regarding restarts, one can follow the logic that any SNMP monitoring
client does: if a sysUpTime is less than it was on a previous read
attempt, the network device (ok, amavisd in this case) was reset and
counters started counting from 0, so one should add their old value
from the last successful read before the restart to obtain a
total count.

  Mark


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
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