Skip to content

Instantly share code, notes, and snippets.

@tresni
Created December 9, 2010 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tresni/735276 to your computer and use it in GitHub Desktop.
Save tresni/735276 to your computer and use it in GitHub Desktop.
Allows you to easily search through your OpenDNS stats for the total number of requests in given months to domains containing a specified string. This requires the fetchstats script from http://github.com/opendns/opendns-fetchstats .
# Usage: ./fetchstats-condensor [USERNAME] [NEEDLE] [LIST_OF_NETWORKS] [LIST OF MONTHS]
# Example: ./fetchstats-condensor example google\.com "all 1" "2010-01 2010-02 2010-03"
USERNAME=$1
NEEDLE=$2
NETWORKS=$3
MONTHS=$4
echo -n "Password for $1: " >&2
stty -echo
read PASSWORD
stty echo
echo >&2
for network in $NETWORKS
do
for month in $MONTHS
do
echo -n "$network, $month, "
echo $PASSWORD | \
./fetchstats $USERNAME $network $month-01 $month-31 2> /dev/null | \
grep $NEEDLE | \
awk '{FS=","; total = total + $3 } END { printf total }'
echo
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment