Adeptus-Mechanicus

Main
Codex
Librarium Whitehat
Advisories
Blog Pics
"Inveniam viam aut faciam" : I will either find a way, or I shall make one


CLI LINE MONITORING

I like linux, and I like my command line interface. It is like being king of an amazing kingdom. You can do just about anything - it's even more fun if you have the root password! But I digress... Anyway, there is now another tool to join the ranks of iptraf, sysstat and all the other useful monitoring CLI tools, its called BWM-NG, the "Bandwidth Monitor". It can be found here, and has a couple of neat little tricks which make it deserviong of mention.

What is Needed?
Well you need linux (duh!) and then the bwm-ng package also needs the libstatgrab libraries (see here). These are installed after extraction with the usual ./configure && make && make install process (You may need to add /usr/local/lib to your /etc/ld.so.conf, and the ldconfig - at least I had to). Then you can get the bwm-ng package..
wget http://www.gropp.org/bwm-ng/bwm-ng-0.5.tar.gz

...and then after extraction you do the --yep, you guessed it -- ./configure && make && make install.

Using it
Using it is simple, just run bwm-ng, you should see something like..
bwm-ng v0.5 (probing every 0.500s), press 'h' for help
  input: /proc/net/dev type: rate
  \       iface                  Rx                   Tx                Total
  ===========================================================================
            lo:           0.00 KB/s            0.00 KB/s            0.00 KB/s
          eth0:           9.15 KB/s           29.89 KB/s           39.04 KB/s
          eth1:          29.37 KB/s            4.15 KB/s           33.52 KB/s
          eth2:           0.00 KB/s            0.14 KB/s            0.14 KB/s
          tap0:           0.00 KB/s            0.00 KB/s            0.00 KB/s
          ppp0:           0.00 KB/s            0.10 KB/s            0.10 KB/s
  ---------------------------------------------------------------------------
         total:          38.52 KB/s           34.28 KB/s           72.80 KB/s

It can run in ascii, ncurses or even output as html (using the -o switch) which is useful for setting up monitoring pages. But lets stick with using it from the CLI, it then functions a lot like the top command. You can use various keys change the display, and rather then lay it out for you myself, here is the very helpful help screen (use the h key)..
 ┌─bwm-ng v0.5 - Keybindings:───────────────────────────────────────────────┐
 │                                                                          │
 │ 'h'  show this help                                                      │
 │ 'q'  exit                                                                │
 │ '+'  increases timeout by 100ms                                          │
 │ '-'  decreases timeout by 100ms                                          │
 │ 'd'  switch KB and auto assign Byte/KB/MB/GB                             │
 │ 'a'  cycle: show all interfaces, only those which are up,                │
 │             only up and not hidden                                       │
 │ 's'  sum hidden ifaces to total aswell or not                            │
 │ 'n'  cycle: input methods                                                │
 │ 'u'  cycle: bytes,bits,packets,errors                                    │
 │ 't'  cycle: current rate, max, sum since start, average for last 30s     │
 │                                                                          │
 └─ press any key to continue... ───────────────────────────────────────────┘


Final Words
And thats about it. Easy, quick and very useful. Install this quickly and spend a lot of time using it.. the way good software should be. Have fun and learn.