ibmonitor
is an interactive linux console application which shows
bandwidth consumed and total data transferred on all interfaces.
Its main features are:
- Shows received, transmitted and total bandwidth of
each interface
- Calculates and displays the combined value of all
interfaces
- Diplays total data transferred per interface in
KB/MB/GB
- Values can be displayed in Kbits/sec(Kbps) and/or
KBytes/sec(KBps)
- Can show maximum bandwidth consumed on each interface
since start of utility
- Can show average bandwidth consumption on each
interface since start of utility
- The output with all features (max, avg and display in
Kbps and KBps) easily fits on a 80x24 console or xterm
- Can interactively change its output display format
depending on key pressed by user.
This project is different from existing similar utilities in that it can
show the values in Kbits/sec (Kbps) and Kbytes/sec (KBps)
simultaneously.
It also displays the total data transferred in KB/MB/GB dynamically
shifting the unit to adjust available field width
Also command line switches are available which allow to choose whether
to display
maximum and average bandwidth.
ibmonitor responds to
certain key presses while running and can dynamically
change its output display format.
eg.
- keypress m
-- Toggle view/hide max of all interfaces
Read the usage section below for more
information about keystrokes available
and their outcome.
Future plans include to make it display dynamic multi-colored graphs
per interface using svgalib, and also make it respond to signals
so that it can communicate its values to other programs which would
need such data.
As an example, envision the following scenario:
- A web CGI script sends a signal to the ibmonitor process via IPC.
- The ibmonitor
process then communicates its data to the signalling process.
- This data is sent to the signalling process via some
predefined method of communication.
- The CGI script then interprets this data and outputs
a nicely formatted HTML page.
Requirements
ibmonitor is
written in the Perl programming language.
Visit perl.com to learn more about this
wonderful language.
The ibmonitor perl script makes use
of the perl modules Term::ReadKey, Term::ANSIColor and Time::HiRes
While Term::ANSIColor is available with most distributions of
perl (and Linux), you can download
Term::ReadKey and Time::HiRes from cpan.org
Download Term::ReadKey
Download Time::HiRes
Currently, this utility will only run on linux distros which support
the /proc filesystem,
due to the fact that ibmonitor reads
the file /proc/net/dev for the byte counter values.
I will try to list all possible OSs here with the /proc file which
should get ibmonitor running on your system.
Any help regarding this would be much appreciated.
Contact me at - arcofdescent at gmail.com
Installation
Just copy the perl script named ibmonitor
into any directory which is
in your path. A good place would be /usr/bin/ibmonitor
Usage
ibmonitor is a command
line program which will run
on a linux console or xterm (rxvt, konsole, gnome-terminal, etc)
usage: ibmonitor [ --bits ] [ --bytes ] [ --max ] [ --avg ] [
--interval n ] [--data]
[ --colors | --nocolors ] [--dev regex] [--file procfile]
[ --help ] [--version]
The following command line options (and their explanation) are
available:
--bits |
Show output values in KBits/sec.
This is the default |
--bytes |
Show output values in KBytes/sec |
--max |
Show maximum values per interface |
--avg |
Show average values per interface |
--interval n
|
Set time interval as n seconds. The
default is 2 seconds |
--data |
Show data transferred in KB/MB/GB |
--colors |
Show some fancy coloring! (This is
the default) |
--nocolors |
No fancy coloring please!
|
--dev regex
|
Show output from device matching
regex
|
--file proc
|
Specify which file to use in the
proc filesystem
for the interface byte counter
|
--help |
Show help and exit
|
--version |
Show version number and exit
|
While running, ibmonitor can read
the input key from the user
and dynamically change its output display format depending on the key
pressed.
The following keys are supported. Note that ibmonitor responds
immediately
to the single keystroke. ie. The 'Enter' key need not be pressed
q
|
[q]uit |
1 - 9
|
Set sleep time interval (in seconds)
to the digit entered |
m |
Toggle display of [m]ax bandwidth |
a
|
Toggle display of [a]verage bandwidth |
i
|
Toggle display of values in
KB[i]ts/sec (Kbps) |
y
|
Toggle display of values in
KB[y]tes/sec (KBps) |
d
|
Toggle display of [d]ata
transferred |
s
|
Shift interface up/down.
This should be followed by the interface number,
and then the direction (u or d)
|
r
|
[R]eset all values |
? / h
|
Help screen for interactive commands |
|
|
|
|