SYNOPSISbmon [ -awShV ] [ -i <mod> ] [ -o <mod> ] [ -I <mod> ] [ -O <mod> ]
[ -f <path> ] [ -p <policy> ] [ -r <float> ] [ -s <float> ]
DESCRIPTIONbmon is a portable bandwidth monitor with multiple input methods and output modes. A set of architecture specific input modules provide the core with the listof interfaces and their counters. The core stores this counters and provides rate estimation including a history over the last 60 seconds, minutes, hours and days to the output modules which output them according to the configuration.
The set of counters is dependant on the input module and may vary. Secondary input and output modules may be used to collect counter values from other nodes or to write HTML statistics. This input/output architecture minimizes the work needed to port it to other architectures or generate specific statistics.
- Set primary input module and its configuration. The argument "list" will result in a list of available input modules. See INPUT MODULES for more details.
- Set primary output module and its configuration. The argument "list" will result in a list of available output modules. See OUTPUT MODULES for more details.
- Set secondary input modules and their configuration. The argument "list" will result in a list of available secondary input modules.
- Set secondary output modules and their configuration. The argument "list" will result in a list of available secondary output modules.
- Set alternative configuration path.
- Set interface acceptance policy. See INTERFACE SELECTION for more details.
- Include interfaces even if their status is down.
- Set reading interval in which the input module will be called. The default for this is one second. Should be less or equal than 1 or a factor of it. Values not equal to 1 will result in additional rate calculation with the read interval as its unit.
- Set sleeping interval between calls to output short interval callbacks for interactive output modules. Changing this can affect the variance of read intervals.
- Enable signal driven output intervals. The output module will only be invoked upon receiving of SIGUSR1. Use bmon -S - to send the signal to a running bmon instance in signal driven mode.
- Send SIGUSR1 to a running bmon instance. This arugment takes either - which will result in invoking ps to find bmon instances or a pid directly.
- Prints a help text and exits.
Prints the version and exits.
Input modules provide the core with interface statistics. Two kinds of modules exist, primary and secondary input modules. Their main difference is usage, there may be only one primary module running at the same time while the number of secondary input modules is not limited.
Every input module has a description, help text and list of options available which can be seen by adding the option "help" to the module options:
- bmon -i netlink:help
See MODULE CONFIGURATION for mode details.
PRIMARY INPUT MODULES
- netlink (Linux)
Requires libnl and uses an rtnetlink to collect interface
statistics. This input module also provides statistics about
traffic control qdiscs and classes. It is the preferred
input module on Linux.
- kstat (SunOS)
Provides interface statistics on SunOS operating systems in
form of 32bit and 64bit counters. It is the preferred input
module on SunOS.
- sysctl (BSD, Darwin)
Provides interface statistics on BSD and Darwin operating
systems. Is is the preferred input module on any BSD
- proc (Linux)
Provides interface statistics on Linux using the proc
filesystem (/proc/net/dev). It is one of the fallback
input modules on Linux and will work on nearly every
Linux kernel version.
- sysfs (Linux)
Provides interface statistics on Linux using the sys
filesystem (/sys/class/net/). It may be used together
with newer Linux kernel versions but has no real
advantage over the netlink input module. It caches
open file descriptors to speed it up and is used
as fallback method.
- netstat (POSIX)
Provides limited interface statistics on almost any
POSIX operating system by invoking netstat -i -a. Only
use this as last hope.
- dummy (any)
The purpose of the dummy input module is for testing. It
generates in either a static or randomized form.
- nulll (any)
Does not provide any interface statistics and thus can be
used to disable local interface collection.
SECONDARY INPUT MODULES
Collects interface statistics from other nodes. It is the
counterpart of the secondary output module called distribution.
Its purpose is to distribute statistics in real time with
not too much bandwidth consumption itself. See DISTRIBUTION
for more details.
Output modules are feeded with rate estimations and graphs from the core and print them out to the configured output device. Two kinds of modules exist, primary and secondary output modules. Their main difference is usage, there may be only one primary module running at the same time while the number of secondary output modules is not limited.
Every output module has a description, help text and list of options available which can be seen by adding the option "help" to the module options:
- bmon -o ascii:help
See MODULE CONFIGURATION for mode details.
PRIMARY OUTPUT MODULES
The ascii output modules prints out the diagrams and
lists to standard output. The output format is highly
configurable and suits as vmstat alike tool for interface
Interactive curses user interface providing real time rate
estimations and graphs. The default view is a list of all
interfaces grouped per node. The graphical history diagram
and a list of detailed counters may be enabled/disable
during runtime. Press '?' while the UI is running to see
the quick reference.
SECONDARY OUTPUT MODULES
Writes all interface statistics and diagrams as HTML files including
a navigation menu for all nodes and their interfaces. The layout
can be easly changes by altering the stylesheet which will not be
- distribution (any)
Distributes all statistics over the network using an UDP based
statistic distribution protocol. The default configuration will
use the multicast address all-nodes but it may also be configured
so send to a unicast address.
ARGUMENT ::= modulename:OPTS[,modulename:OPTS[,...]]
OPTS ::= OPTION[;OPTION[;...]]
OPTION ::= type[=value]
If you specify multiple primrary input or output modules the first reported to be working module will be used.
If you specify multiple secondary input or output modules all of them will get invoked.
Statistic distribution is a powerful method to spread the statistic all over the network and make the available on every machine. The advantage over web based statistic overviews and multi terminal remote shell based solutions is its nearly realtime accuracy while being lightweight and not polluting the network too much. The protocol is UDP based and thus not reliable and optmized on size.
See include/bmon/distribution.h for the protocol specification.
You will find the following diagram types being used by all output modules in some form:
A list of interfaces including their byte and packets rate (bps/pps).
- graphical history diagram
A graph showing the history of a counter over the last 60 (read interval/
seconds/minutes/hours/days). The outer left column is the most recent
rate while the outer right column is the most outdated. The preferred
diagram to impress co-workers.
Detailed counters such as error counters or other attributes assigned
to this interface. The list of attributes may very depending on the
input module and architecture of the host OS.
SELECTION ::= NAME[,NAME[,...]]
NAME ::= [!]interface
The interface name may contain the character '*' which will act as a wildcard and represents any number of any character type, i.e. eth*, h*0, ...
Bmon will try and read configuration data from the following files in the specified order: /etc/bmon.conf, $HOME/.bmonrc.
None of the above files will be read if the path to the configuration file was specified using the -f option.
input <module configuration>
Specify primary input module (-i), see INPUT MODULES.
secondary_input <module configuration>
Specify secondary input modules (-I), see INPUT MODULES.
output <module configuration>
Specify primary output module (-o), see OUTPUT MODULES.
secondary_output <module configuration>
Specify secondary output modules (-O), see OUTPUT MODULES.
Set interface acceptance policy (-p), see INTERFACE SELECTION.
Set reading interval in which the input module will be called (-r).
Set sleeping interval between calls to output short interval callbacks for interactive output modules. (-s)
Include interface even if their status is down. (-a)
Include file and read it as configuration file.
See COLOR LAYOUTS.
See BIND INTERFACE.
The layout is used to specify the look'n'feel of the curses output module. The color "default" represents the terminal color which can be used to keep the background transparent for transparent terminals.
Colors: default, black, red, green, yellow, blue, magenta, cyan, white
Layouts: Default, Statusbar, Header, List, Selected,
Layout <name> <foreground> <background> <flags>
Layout Statusbar red black reverse
Feel free to submit patches extending the configurability using layouts.
The bind interface can be used to bind not yet assigned keys to shell scripts. It currently works in the curses output module but it might be ported to other output modules in the future. The interface name of the currently selected interface is provided to the script via the first argument.
Bind <key> <Executable>
bind D /sbin/intf_down.sh
To run bmon in curses mode monitoring the interfaces eth0 and eth1:
- bmon -i eth0,eth1 -o curses
To run bmon in acii mode printing the detailed diagram with fixed y-axis unit:
- bmon -o 'ascii:diagram=detailed;ynit=kb'
To run bmon in signal driven mode drawing the graphical diagram with customized drawing characters and fixed x and y axis:
- bmon -s -o 'ascii:diagram=graph;fgchar=#;bgcar=_;xunit=min'
To run bmon with no primrary output (daemon) but distribute the statistic over the network:
- bmon -o null -O distribution
To run bmon collecting local and remote statistics and show it in curses mode:
- bmon -I distribution:multicast -o curses
To build a relay and collect remote statistic and send them to a unicast address while ignoring errors because the destination is not available:
- bmon -i null -I distribution:multicast -o null -O 'distribution:ip=10.0.0.1;errignore;forward'
To collect local statistics and those from the whole network and generate a HTML page out of the those statistics:
- bmon -I distribution:multicast -o null -O html:path=/var/istats/
KNOWN ISSUESThe curses output modules doesn't work properly on NetBSD < 2.0 because getch() cannot be set to be non-blocking.
sysctl input segfaults on sparc64 OpenBSD.
AUTHORThomas Graf <[email protected]>