# period
sakums=`date -d -1day +%s`
# 1GB
ttrafic=$((1024*1024*1024))
pushd /var/www/mrtg
for fails in `find *log -mtime -1`
do tail -n +4 $fails |
awk -vsakums=$sakums -vfails=$fails -vttrafic=$ttrafic '{ if ($1 > sakums)
{intr += ($2*300); outtr += ($3*300) }}
END { if (outtr > 10000000000)
printf("%s\t%10.2f\t%10.2f\n",fails,intr/ttrafic,outtr/ttrafic) }'
done
trešdiena, 2011. gada 18. maijs
Total traffic counter from MRTG log files
Script to count total traffic for last day for switch port from MRTG log files, and output file name, if total traffic is more than 10GB.
Abonēt:
Ziņas (Atom)