Sarg scripts

Ivailo Tanusheff i.tanusheff at procreditbank.bg
Thu Nov 17 08:21:30 GMT 2005


Maybe mine is not perfect, but this is what I use at work :)
I use several conf files, like sarg_proxy_daily.conf. The only difference 
between those files is where to put output files, as I use different 
filders for different type or reports, i.e. I have dayly, weekly, monthly 
and yearly folder :)
You can use only one config to store all data in the same place or use 
proper command option. Hope this will help you:



root at logserver# cat /usr/local/etc/reports/proxy_squid.sh
#!/bin/sh -x

######################
#                       #
#       Config                  #
#                                       #
#####################

LOGDIR=/data/proxy/logs

TODAY=$(date +%d/%m/%Y)
YESTERDAY=$(date -v-1d +%d/%m/%Y)
WEEKAGO=$(date -v-1w -v-1d +%d/%m/%Y)
MONTHAGO=$(date -v-1m -v-1d +%d/%m/%Y)
YEARAGO=$(date -v-1y -v-1d +%d/%m/%Y) 


###################### 
#                                       #
#       Script                          #
#                                       #
#####################


if [ $# -ne 1 ]; then
  /bin/echo "Usage: `basename $0` [d|w|m|y]"
  exit 0
fi


case "$1" in
  d)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_daily.conf -d 
$YESTERDAY-$YESTERDAY -x
    ;;

  w)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_weekly.conf -d 
$WEEKAGO-$YESTERDAY
    ;;

  m)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_monthly.conf -d 
$MONTHAGO-$YESTERDAY 
    ;;

  y)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_yearly.conf -d 
$YEARAGO-$YESTERDAY
    ;;
 
  *)
    /bin/echo "Usage: `basename $0` [d|w|m|y]"
    ;;
esac



Ivailo Tanusheff
Senior System administrator
ProCredit Bank (Bulgaria) AD
http://www.procreditbank.bg




Chris <racerx at makeworld.com> 
Sent by: owner-freebsd-questions at freebsd.org
11/17/2005 02:24 AM
Please respond to
RacerX at makeworld.com


To
FreeBSD - Questions <freebsd-questions at freebsd.org>, FreeBSD - Ports 
<freebsd-ports at freeBSD.org>
cc

Subject
Sarg scripts






If anyone is using sarg (/usr/ports/www/sarg) I would really appreciate
what you are doing for gathering daily/weekly/monthly info.

This would be in the form of scripts I assume and cron.


-- 
Best regards,
Chris

You can observe a lot just by watching.
_______________________________________________
freebsd-questions at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list