This file is indexed.

/usr/share/munin/plugins/amavis is in munin-node 1.4.6-3ubuntu3.4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/sh
# -*- sh -*-
# vim: ft=sh

: <<=cut

=head1 NAME

amavis - plugin to monitor the amavis mail filter.

=head1 APPLICABLE SYSTEMS

Hosts running amavis localy and logtail(8) installed.

=head1 CONFIGURATION

The configuration environment variables are available

=over 4

=item amavislog

Path to logfile (Default: "/var/log/mail/mail.info")

=item logtail

Path to logtail command (Default: "logtail")

=back

On most systems the mail logs are not readable by nobody which the
plugin usually runs at.  To enable log reading it needs to run as a
group or user that has read access, as shown above.

By default the logtail program is started without any explicit path,
but if it is not found in the system $PATH then you'll need to specify
the full path for the program.

=head2 EXAMPLE CONFIGURATION

The following shows a typical configuration:

  [amavis]
     env.amavislog     /var/log/mail/mail.info
     env.logtail       /usr/bin/logtail
     group adm

=head1 INTERPRETATION

The plugin shows "probable spam", "surley spam" and "virus".  If your
"probable spam" raises you may need to tune your spam configuration to
classify more spam as "surley spam" and so be able to elliminate it.

=head1 MAGIC MARKERS

  #%# family=auto
  #%# capabilities=autoconf

=head1 VERSION

  $Id: amavis.in 3441 2010-03-18 20:07:35Z feiner.tom $

=head1 BUGS

Should use counters since the origin data is really counters.  If the
node has multiple masters the data served will now be incorrect.
Proper operation may require porting to perl or such.

=head1 AUTHOR

Unknown

=head1 LICENSE

GPLv2

=cut

mktempfile () {
    cmd=`echo $MUNIN_MKTEMP | sed s/\\$1/$1/`
    $cmd
}

AMAVIS_LOG=${amavislog:-/var/log/mail/mail.info}
LOGTAIL=${logtail:-logtail}
STATEFILE=$MUNIN_PLUGSTATE/amavis.offset

if [ "$1" = "autoconf" ]; then
        if [ -f "${AMAVIS_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
		echo yes
		exit 0
	else
		echo no
		exit 0
	fi
fi

# Try tailing a random file to check how arguments are passed
ARGS=0
`$LOGTAIL /etc/hosts 2>/dev/null >/dev/null`
if [ $? = 66 ]; then
    if [ ! -n "$logtail" ]; then
	ARGS=1
    fi
fi

if [ "$1" = "config" ]; then
	echo 'graph_title Amavis filter statistics'
	echo 'graph_vlabel \#'
	echo 'graph_category antivirus'
	echo 'virus.label virus'
	echo 'virus.info Number of viruses caught in email'
	echo 'spam_maybe.label probably spam'
	echo 'spam_maybe.info Emails amavis thinks probably contains spam'
	echo 'spam_sure.label surely spam'
	echo 'spam_sure.info Emails amavis is sure contains spam'
	echo 'total.label total mails'
	echo 'total.info Total emails evaluated by amavis'
	exit 0
fi

total=U
virus=U
spamm=U
spams=U

TEMP_FILE=$(mktempfile munin-amavis.XXXXXX)

if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
	if [ $ARGS != 0 ]; then
	    $LOGTAIL -f ${AMAVIS_LOG} -o ${STATEFILE} | grep 'amavis\[.*\]:' > ${TEMP_FILE}
	else
	    $LOGTAIL ${AMAVIS_LOG} ${STATEFILE} | grep 'amavis\[.*\]:' > ${TEMP_FILE}
	fi
	total=$(grep -c 'Passed' ${TEMP_FILE})
	virus=$(grep -c 'INFECTED' ${TEMP_FILE})
	spamm=$(grep -c 'Passed.*Hits: 1[0-9][.]' ${TEMP_FILE})
	spams=$(grep -c 'Passed.*Hits: [2-9][0-9][0-9]*[.]' ${TEMP_FILE})

	/bin/rm -f $TEMP_FILE
fi

echo "virus.value ${virus}"
echo "spam_maybe.value ${spamm}"
echo "spam_sure.value ${spams}"
echo "total.value ${total}"