~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d/amavis.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Plugin to monitor the amavis mail filter.
 
4
#
 
5
# Usage: Place in /etc/lrrd/client.d/ (or link it there  using ln -s)
 
6
#
 
7
# Parameters understood:
 
8
#
 
9
#       config   (required)
 
10
#       autoconf (optional)
 
11
#
 
12
# Config variables:
 
13
#
 
14
#       amavislog    - file where amavis logs are written
 
15
#
 
16
 
 
17
TEMP_FILE=/tmp/lrrd-amavis
 
18
AMAVIS_LOG=/var/log/mail/mail.info
 
19
LOGTAIL=`which logtail`
 
20
 
 
21
if [ "$amavislog"  ]; then AMAVIS_LOG=$amavislog ; fi
 
22
 
 
23
if [ "$1" = "autoconf" ]; then
 
24
        if [ -f ${AMAVIS_LOG} -a -x ${LOGTAIL} ] ; then
 
25
                echo yes
 
26
                exit 0
 
27
        else
 
28
                echo no
 
29
                exit 1
 
30
        fi
 
31
fi
 
32
 
 
33
if [ "$1" = "config" ]; then
 
34
        echo 'graph_title Amavis filter statistics'
 
35
        echo 'graph_order virus spam_maybe spam_sure total'
 
36
        echo 'graph_vlabel nb'
 
37
        echo 'virus.label virus'
 
38
        echo 'spam_maybe.label probably spam'
 
39
        echo 'spam_sure.label surely spam'
 
40
        echo 'total.label total'
 
41
        exit 0
 
42
fi
 
43
 
 
44
logtail ${AMAVIS_LOG} | grep 'amavis\[.*\]:' > ${TEMP_FILE}
 
45
total=`cat ${TEMP_FILE} | wc -l`
 
46
virus=`grep INFECTED ${TEMP_FILE} | wc -l`
 
47
spamm=`grep 'Passed.*Hits: 1[0-9][.]' ${TEMP_FILE} | wc -l`
 
48
spams=`grep 'Passed.*Hits: [2-9][0-9][0-9]*[.]' ${TEMP_FILE} | wc -l`
 
49
 
 
50
echo "virus.value ${virus}"
 
51
echo "spam_maybe.value ${spamm}"
 
52
echo "spam_sure.value ${spams}"
 
53
echo "total.value ${total}"