I.T. Security and Linux Administration

Sep 28 2011   11:37AM GMT

Bandwidth Monitoring With bwbar

Eric Hansen Eric Hansen Profile: Eric Hansen

There’s quite a few systems out there that like to present to you a fancy graph and such information on the system’s bandwidth usage.  However, if you’re looking for something simple and straight to the point (and optionally have a web server running), bwbar is what you should be using.  Its a lightweight, easy to use, and easy on resources solution for displaying current bandwidth usage, written in C (or C++).  (More information about the program itself can’t be found as kernel.org is down…still…).  But, in this article I will show you how to use this tool to give you an overview of your bandwidth usage.

First thing I would like to note is that a web server isn’t needed for this, if you’re running this on a desktop environment and can view PNG files.  There’s also a text file output, but that’s not going to make your eyes “ooh” and “aah”, now is it?

First thing’s first, check to make sure your distribution’s repositories have bwbar, as I’m not sure where else you can download it currently.  For Arch Linux, it’s a 0.02 MB file, but as libpng is a dependency for this, it might be a little more if you don’t have that pre-installed.

I’ve seen a lot of guides out there that say to use the “-d” switch, but…its not there.  I had one heck of a time trying to figure out how to get the data to actually output instead of seeing the help screen every time.  What you want to do is cd into the directory you want the data to be stored in, and run this command (changing the “-f” (text file) and “-p” (PNG file) options if you want something besides ubar.(png|txt)):

bwbar -k -i -o -p bw.png -t 2 eth0 100 &

Since I don’t use a lot of bandwidth on my server, I have it measure in kilobits (-k), but the default is megabits (-m).  The -i and -o are for measuring input and output data respectively.  -t is for the time (in seconds) you want it to refresh, with a default of 15, then the interface (eth0) you want to monitor, and the maximum amount of bits (100 is usually a good start).  If you don’t specify -f or -p, then it’ll use the defaults, so if you don’t want a text file, you can (assumingly) use /dev/null for the file.  Now you’ll have a fancy png file (which you can also manipulate, if needed/wanted).

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: