Oct 032008
 

Bandwidth Monitor NG (bwm-ng) is a small and simple console-based live network and disk io bandwidth monitor for Linux, BSD, Solaris, Mac OS X and others. There is no fancy GUI or interfaces simple console utility which installs and runs flawlessly showing live stats of your Network or Disk I/O stats.


Features include

support for /proc/net/dev, netstat, getifaddr, sysctl, kstat for Network Monitoring

support for /proc/diskstats /proc/partitions, IOKit, devstat and libstatgrab for Disk I/O Monitoring

Support for unlimited number of Network interfaces/devices

Dynamic Addition and Deletion of interfaces/devices to the list

Whitelist and blacklist of interfaces/devices

Output formats of KB/s, Kb/s, packets, errors, average, max and total sum

Output in curses, plain console, CSV or HTML

Install bwm-ng

Bandwidth monitor NG can quickly be built from source. Download bwm-ng from here or from a terminal window as follows:

opensuse11:~ # wget http://www.gropp.org/bwm-ng/bwm-ng-0.6.tar.gz

Unzip & Untar bwm-ng

opensuse11:~ # tar -zxvf bwm-ng-0.6.tar.gz

Install GCC and Make utility

If you do not already have the GCC compiler and the make utility then install as follows. If already installed then you can skip this step.

opensuse11:~ # yast2 -i gcc make

Now, change directory to the newly created bwm-ng directory and run configure.

opensuse11:~ # cd bwm-ng-0.6

opensuse11:~/bwm-ng-0.6 # ./configure

Compile & Install

Now, compile and install bwm-ng as follows:

opensuse11:~/bwm-ng-0.6 # make && make install

This should install bwm-ng under /usr/local/bin/bwm-ng

opensuse11:~ # which bwm-ng
/usr/local/bin/bwm-ng

Run bwm-ng

To see the stats of all the interfaces (including Wireless interfaces) on the system simply run bwm-ng without any arguements. At anytime press <CTRL+C> to stop monitoring the stats.

opensuse11:~ # bwm-ng

Monitor all Network Interfaces
To see stats on a specific interface,

opensuse11:~ # bwm-ng -I wlan0

Monitor select interface
To check Disk I/O stats,

opensuse11:~ # bwm-ng -i disk


For more options, run bwm-ng with “-h” arguement to show the options

opensuse:~/bwm-ng-0.6 # bwm-ng -h
Bandwidth Monitor NG (bwm-ng) v0.6
Copyright (C) 2004-2007 Volker Gropp <bwmng@gropp.org>
USAGE: bwm-ng [OPTION] … [CONFIGFILE]
displays current ethernet interfaces stats

Options:
-t, –timeout <msec>    displays stats every <msec> (1msec = 1/1000sec)
default: 500
-d, –dynamic [value]   show values dynamicly (Byte KB or MB)
-a, –allif [mode]      where mode is one of:
0=show only up (and selected) interfaces
1=show all up interfaces (default)
2=show all and down interfaces
-I, –interfaces <list> show only interfaces in <list> (comma seperated), or
if list is prefaced with % show all but interfaces
in list
-S, –sumhidden [value] count hidden interfaces for total
-A, –avglength <sec>   sets the span of average stats (Default 30s)
-D, –daemon [value]    fork into background and daemonize
-h, –help              displays this help
-V, –version           print version info

Input:
-i, –input <method>    input method, one of: proc netstat disk
-f, –procfile <file>   filename to read raw data from. (/proc/net/dev)
–diskstatsfile <file> filename to read diskstats (Linux 2.6+) from. (/proc/diskstats)
–partitionsfile <file> filename to read diskstats (Linux 2.4) from. (/proc/partitions)

Output:
-o, –output <method>   output method, one of:
plain, csv, html
-u, –unit <value>      unit to show. one of bytes, bits, packets, errors
-T, –type <value>      type of stats. one of rate, max, sum, avg
-C, –csvchar <char>    delimiter for csv
-F, –outfile <file>    output file for csv and html (default stdout)
-R, –htmlrefresh <num> meta refresh for html output
-H, –htmlheader        show <html> and <meta> frame for html output
-c, –count <num>       number of query/output for plain & csv
-N, –ansiout           disable ansi codes for plain output
(ie 1 for one single output)

A simple but useful tool when trying to troubleshoot network problems or when there is a Disk I/O performance issue. Click here to visit the project homepage.