Thank you very much!  I never know how to extract the raw data from rrdlogs, 
now I know it's actually not that hard.

(BTW: the AWK is fine, although you can omit the cut(1) stage in the pipe 
simply by having awk add up $2 and $3 instead of $1 and $2.)

-Adam Thompson
 Chief Technical Architect, C3A Inc.
 athom...@c3a.ca
 (204) 272-9628 / fax: (204) 272-8291


-----Original Message-----
From: Jim Pingle [mailto:li...@pingle.org] 
Sent: June-18-10 12:23 PM
To: support@pfsense.com
Subject: Re: [pfSense Support] Bandwdith usage since start of month?

On 6/18/2010 12:04 PM, Adam Thompson wrote:
> Is there a way to get this information?

Try this command at the CLI, do the values look right when compared to
the graph? My awk-fu isn't that good, there's probably a better way to
do this:

(This should all be one single line)

rrdtool fetch /var/db/rrd/wan-traffic.rrd AVERAGE -r 3600 -s '00:00
06/01/2010' -e now | grep -v nan | cut -f2 -d':' | awk '{ sum1 +=
$1/(1024*1024); sum2 += $2/(1024*1024) } END { printf "IN: %u Mbytes
OUT: %u Mbytes\n", sum1*3600, sum2*3600; }'

I had to use Mbytes since using bytes made awk roll overflow its integer
type :-)

If you have more than one WAN, you can repeat that with
opt1-traffic.rrd, etc.

Jim

Reply via email to