Hi Bob,
On Saturday 31 October 2009 11:41 AM, Bob Goodwin wrote:
My objective being to keep a record of daily bandwidth usage. [35% or
6.0 gB is my current usage, 17.0 the 30 day download allotment, the
other numbers for upload usage.]
I know this is not the answer to your question but since you mention you
want to monitor your bandwidth usage, you could try vnstat[1]. Its a
very nifty light weight utility which keeps track of your network
traffic by running cron jobs at small intervals of time[2] and presents
all the information in neat graphs on the console.
It looks something like this (monthly, daily and hourly usage),
$ vnstat -m
eth0 / monthly
month rx | tx | total
-------------------------+--------------+--------------------------------------
Jul '09 27.70 GB | 4.04 GB | 31.74 GB %%%%%:
Aug '09 47.89 GB | 8.53 GB | 56.41 GB %%%%%%%%%::
Sep '09 46.46 GB | 22.15 GB | 68.61 GB %%%%%%%%%::::
Oct '09 77.20 GB | 35.38 GB | 112.58 GB %%%%%%%%%%%%%%%:::::::
-------------------------+--------------+--------------------------------------
estimated 78.04 GB | 35.76 GB | 113.80 GB
$ vnstat -d
eth0 / daily
day rx | tx | total
------------------------+-------------+----------------------------------------
02.10. 9.06 GB | 4.31 GB | 13.37 GB %%%%%%%%%%%%%%%%:::::::
03.10. 9.55 GB | 4.56 GB | 14.11 GB %%%%%%%%%%%%%%%%%::::::::
04.10. 6.15 GB | 1.94 GB | 8.09 GB %%%%%%%%%%%:::
05.10. 5.76 GB | 4.66 GB | 10.41 GB %%%%%%%%%%::::::::
-----8<-----
31.10. 795.75 MB | 82.77 MB | 878.52 MB %
------------------------+-------------+----------------------------------------
estimated 1.16 GB | 122 MB | 1.28 GB
$ vnstat -h
eth0 16:00
^ r
| r
| r
| r
| r r
| r r r r
| r r r r
| r r r r r
| r r r r r
| r r r r r r
-+--------------------------------------------------------------------------->
| 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
h rx (kB) tx (kB) h rx (kB) tx (kB) h rx (kB) tx (kB)
17 0 0 01 97,631 7,115 09 1,779 2,677
18 0 0 02 12,936 3,909 10 1,73,799 9,531
19 0 0 03 3,022 2,440 11 6,405 5,535
20 0 0 04 2,996 2,945 12 9,107 6,131
21 0 0 05 1,760 2,679 13 5,130 5,477
22 0 0 06 1,769 2,692 14 51,841 6,879
23 1,68,340 6,300 07 1,739 2,680 15 1,59,879 12,284
00 2,83,305 9,102 08 1,755 2,676 16 0 0
Hope this is of use.
[1]
http://humdi.net/vnstat/
[2] The cron job is like this,
$ cat /etc/cron.d/vnstat
MAILTO=root
# to enable interface monitoring via vnstat remove comment on next line
# */5 * * * * vnstat /usr/sbin/vnstat.cron
0-55/5 * * * * root if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc
-l` -ge 1 ]; then /usr/bin/vnstat -u; fi
--
Suvayu
Open source is the future. It sets us free.