SpamAssassin (lugin) with Munin

Discussion in 'Server Operation' started by edge, Aug 16, 2006.

  1. edge

    edge Active Member Moderator

    SpamAssassin with Munin - plugin

    I'm trying to get the following plugin (see code) for Munin to work with SpamaAssassin.
    Munin is showing the graph, but it's always at 0. (even when SpamAssasin is marking emails with ***SPAM*** )

    I think the problem is the grep "spamd" /var/log/syslog >> /tmp/$$ part!

    I'm using this plugin on a Debian Sarge 3.1 server (the perfect setup) with ISPconfig on it.

    Anyone here who might have a fix for this?


    Code:
    #!/bin/sh
    #
    # Plugin to count the SpamAssassin troughput
    #
    # Contributed by David Obando - 16.11.2005
    #
    #
    # Magic markers - optional - used by installation scripts and
    # munin-config:
    #
    #%# family=manual
    #%# capabilities=autoconf
    
    if [ "$1" = "autoconf" ]; then
            echo yes
            exit 0
    fi
    
    if [ "$1" = "config" ]; then
    
            echo 'graph_title SpamAssassin amount'
            echo 'graph_args --base 1000 -l 0 '
            echo 'graph_vlabel  SpamAssassin amount'
            echo 'graph_order spam ham'
            echo 'graph_category Mail'
            echo 'ham.label ham'
            echo 'ham.type DERIVE'
            echo 'ham.min 0'
            echo 'ham.draw LINE2'
            echo 'spam.label spam'
            echo 'spam.type DERIVE'
            echo 'spam.min 0'
            echo 'spam.draw AREA'
            exit 0
    fi
    
    grep "spamd" /var/log/syslog >> /tmp/$$
    
    echo -n "spam.value " && grep "identified spam" /tmp/$$ | wc -l
    echo -n "ham.value " && grep "clean message" /tmp/$$ | wc -l
    
    rm /tmp/$$
    
    
     
    Last edited: Aug 17, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

    Do you see the string spamd in /var/log/syslog? Shouldn't it be /var/log/mail.log (on Debian)?
     
  3. edge

    edge Active Member Moderator

    No.. No spamd (or even spam) in mail.log or syslog (not even in the .0, .1.gz ect..) And yes.. We do get a lot of spam on that box!

    I do see host postfix/smtpd[12961]: connect from atropos-spam3.cleartel ... in the syslog some times, but thats the closest it will get with something in it like spam!

    Normaly (I think) stuff like this does get writen in the mail.log file, but for some reason it's a no go on my system!
    Could ISPconfig have something todo with this?
     
    Last edited: Aug 17, 2006
  4. falko

    falko Super Moderator Howtoforge Staff

    SpamAssassin does not log to mail.log. It's called by procmail. You'd have to change the SpamAssassin setup so that it is called by amavisd or something like that which logs to mail.log.
     
  5. edge

    edge Active Member Moderator

    Thank you Till,

    I'll have a look and see if I can get it going.
    It would be a nice exta thing to see in Munin :)
     

Share This Page