Re: Reputation database

From: Christian Rößner <cr_at_sys4.de>
Date: Mon, 29 Oct 2012 19:07:40 +0100

Hi,

>> So I remove the stats file each time to suppress the duplicate warnings. But this way I can not do anything else on stats. Is there any other mechanism, yet?
>
> You'd have to write your own script that does opendkim-importstats and then sends the file to the central service before deleting it. We don't provide one in the current distribution, probably because we haven't had anyone yet that wants to do both things.
>
just wrote a little script:

---------------------------------------------------------------
#!/bin/bash

DBHOST="localhost"
DBNAME="opendkim"
DBUSER="opendkim"
DBPASS="opendkim"

DBPORT="3306"
DBSCHEME="mysql"

STATSFILE="/var/lib/opendkim/stats-verify"

WWW_GRAPH="/var/www/graphs/index.html"
WWW_STATS="/var/www/stats/index.html"


case "$1" in
        hourly)
                # Fill new stats data into SQL database
                if [[ -f ${STATSFILE} ]]; then
                        opendkim-importstats \
                                -h ${DBHOST} \
                                -P ${DBPORT} \
                                -u ${DBUSER} \
                                -p ${DBPASS} \
                                -s ${DBSCHEME} \
                                < ${STATSFILE}
                        rm -rf ${STATSFILE}
                fi

                # Refresh all graphs
                opendkim-gengraphs \
                        --dbhost=${DBHOST} \
                        --dbport=${DBPORT} \
                        --dbuser=${DBUSER} \
                        --dbpasswd=${DBPASS} \
                        --output=${WWW_GRAPH}

                # Refresh all statistics
                opendkim-genstats \
                        --dbhost=${DBHOST} \
                        --dbport=${DBPORT} \
                        --dbuser=${DBUSER} \
                        --dbpasswd=${DBPASS} \
                        --output=${WWW_STATS}
                ;;
        daily)
                # Caluculate total rates
                opendkim-modtotals \
                        --dbhost=${DBHOST} \
                        --dbport=${DBPORT} \
                        --dbuser=${DBUSER} \
                        --dbpasswd=${DBPASS}

                # Generate rates for the reputation service
                opendkim-genrates \
                        --dbhost=${DBHOST} \
                        --dbport=${DBPORT} \
                        --dbuser=${DBUSER} \
                        --dbpasswd=${DBPASS}
                ;;
        *)
                echo "$0 {hourly|daily}"
                exit 1
                ;;
esac

exit 0
---------------------------------------------------------------

cron entries:
---------------------------------------------------------------
_at_hourly opendkim-reputation.sh hourly
_at_daily opendkim-reputation.sh daily
---------------------------------------------------------------

Not sure, if that is correct. Enjoy…

Kind regards

-Christian Rößner

--
[*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Joerg Heidrich
Received on Mon Oct 29 2012 - 18:07:50 PST

This archive was generated by hypermail 2.3.0 : Mon Oct 29 2012 - 23:20:44 PST