Bandwidth Usage Statistics
Introduction
Here is a simple shell script to calculate the bandwidth usage on the external interface of a BSD or Linux box. Netstat bandwidth summary works well on OpenBSD 4.1, but colleagues have mentioned 3.9 may not work. Linux should work without issue. Also, remember that the netstat stats will reset on reboot of the box.
One could use this script to keep track of Internet bandwidth in case their ISP accused them of using too much bandwidth. Comcast for example will call foul if you use more than 90 to 150 gigabytes of download per month. We can only guess that the upload limit is the same. Verizon says they do not have a limit, but they will contact bandwidth abusers. Your ISP might have different rules so check with them. Then use this simple tool to make sure you know what you are using.
This is what the report of my system looks like…
|
|
Script
You could put the executable line into /etc/daily
on the 13th line. This way you will get an email in the “daily output” email the BSD box sends and includes the above stats.
Here is the script called “calomel_interface_stats.sh”:
|
|
Last updated 07 Oct 2007, 10:25 CEST.