#!/bin/bash

zabbixLog=$1
tab=${2:-11}
divider=${3:-1000}

searchDate=`date --date="-1 min" "+%d/%b/%Y:%H:%M"`

grep $searchDate $zabbixLog | awk -vFPAT="([^ ]+)|(\"[^\"]+\")" '{print $'$tab'}' | awk -F' ' 'BEGIN {total=0;count=1;}{total+=$1;count++}END { if ( count == 0 ) print count; else print (total/'$divider'/count)}'
