Files
munin-plugins/clamav

50 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# Plugin to count the ClamAntivirus troughput
#
# Adapted from the spamassassin plugin by David Obando
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -r /var/log/syslog ]; then
echo "yes"
else
echo "no (cannot read /var/log/syslog)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title ClamAv stats'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel ClamAv mail/sec'
echo 'graph_order clean infected'
echo 'graph_category Mail'
echo 'clean.label clean'
echo 'clean.type DERIVE'
echo 'clean.colour 0066CC'
echo 'clean.min 0'
echo 'clean.draw LINE1'
echo 'infected.label infected'
echo 'infected.colour cc0033'
echo 'infected.type DERIVE'
echo 'infected.min 0'
echo 'infected.draw LINE1'
exit 0
fi
# create a secure tmp file
TEMP=`/bin/mktemp /tmp/clamav-XXXXXX`
egrep "X-Virus-Status" /var/log/mail.log >> $TEMP
echo -n "infected.value " && grep "Infected" $TEMP | wc -l
echo -n "clean.value " && grep "Clean" $TEMP | wc -l
rm $TEMP