| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|