plugins-qmailqueue-virus2: virus2

File virus2, 1.8 kB (added by david@cryptix.de, 6 years ago)

Plugin to show the Types of Virii (qmailscan)

Line 
1 #!/bin/sh
2 #
3 # Plugin to show the Types of Virii
4 #
5 #
6 # Contributed by David Obando (david@cryptix.de) - 23.11.2005
7 #
8 #
9 # Magic markers - optional - used by installation scripts and
10 # munin-config:
11 #
12 #%# family=manual
13 #%# capabilities=autoconf
14
15 if [ "$1" = "autoconf" ]; then
16         echo yes
17         exit 0
18 fi
19
20 if [ "$1" = "config" ]; then
21
22         echo 'graph_title Virus types'
23         echo 'graph_args --base 1000 -l 0 '
24         echo 'graph_vlabel Daily Virus Types'
25         echo 'graph_category Mail'
26         grep "`date +%d\ %b\ %Y`" /var/spool/qmailscan/quarantine.log /var/spool/qmailscan/quarantine.log.1 > /tmp/q$$
27         egrep -v 'Disallowed  characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' /tmp/q$$ > /tmp/q2$$
28         sed 's/clamdscan.*$//' /tmp/q2$$ | sed 's/[ \t]*$//' > /tmp/q$$
29         cut -f 5 /tmp/q$$ | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do
30                 name=`echo $i | awk '{print $2}'`;
31                 echo "$name.label $name" ;
32                 echo "'$name.draw LINE2";
33         done
34         rm /tmp/q$$ /tmp/q2$$
35
36         exit 0
37 fi
38
39 grep "`date +%d\ %b\ %Y`" /var/spool/qmailscan/quarantine.log /var/spool/qmailscan/quarantine.log.1 > /tmp/q$$
40 egrep -v 'Disallowed  characters found in MIME headers|Disallowed breakage found in header name - potential virus|Disallowed MIME comment found in header name - potential virus' /tmp/q$$ > /tmp/q2$$
41 sed 's/clamdscan.*$//' /tmp/q2$$ | sed 's/[ \t]*$//' > /tmp/q$$
42
43 #awk '{ print $NF }' /tmp/q$$ | sort | uniq -c | sed 's/\./_/g' | while read i; do
44 cut -f 5 /tmp/q$$ | sort | uniq -c | sort -r | sed 's/\.\|-/_/g' | while read i; do
45         name=`echo $i | awk '{print $2}'`;
46         echo -n "$name.value " ;
47         echo $i | awk '{print $1}'
48 done
49
50 rm /tmp/q$$ /tmp/q2$$
51