yabm – Yet Another Bandwidth Meter

yabm is a yet another bandwidth meter/monitor, but developed for FreeBSD.

Using the PNG image format it displays a graphical representation of the current bandwidth usage.

It should run on any recent FreeBSD version >= 4.10, it has been tested on
4.10, 4.11, 5.3 and 6.0-current.

Features

  • Can produce statistics based on both interface or assigned ip-address basis.
  • Possible to run non-root and non-setuid (only interface-based).
  • Customizable parameters (width, height, colours, device max speed).
  • Display realtime statistics or average over any number of seconds (default 60, 1 min/avg).
  • Text output of bandwidth utilization.

Download

Version: 0.2.1 (20050421)
yabm-0.2.1.tar.gz

Available from the FreeBSD ports tree in net-mgmt/yabm

Changes

0.2.1 – 20050421
* Correct wrong path i FreeBSD startup script.
* Suffixes in text display has been changed to B, KiB, MiB, GiB for octets
and to bits, Kbits, Mbits, Gbits for bit display.
* Added -k option to change how many “markers” that should be drawn.
0.2 – 20050114
* Fixes all bugs found in 0.1 :)
* Better error-checking, more friendly error messages.
* Text support added.
* FreeBSD startup script.
0.1 – 20050111
* Initial release.

In-action/screenshot

Green represents incoming traffic and blue represents outgoing traffic.

yabm screenshot

Installation/Configuration

Make sure you’ve got libpng install, then installation is simple just type

make
make install

There is a FreeBSD startup script in scripts/ to install it do the following

The following only applies if you want to use the included startup script, you
can run yabm without this.

cd scripts
make
mv yabm.sh /usr/local/etc/rc.d
chmod 0755 /usr/local/etc/rc.d/yabm.sh

Example; To make yabm monitor interface fxp0, rl0 and ip-address 192.168.0.1 the following
must be added to /etc/rc.conf

yabm_enable="YES"

yabm_if0="fxp0"
yabm_if0_output="/usr/local/www/bw-fxp0.png"
yabm_if0_flags="-t"

yabm_if1="rl0"
yabm_if1_output="/usr/local/www/bw-rl0.png"
yabm_if1_flags="-m 512k -t"

yabm_alias0="192.168.0.1"
yabm_alias0_output="/usr/local/www/bw-ip.png"
yabm_alias0_flags=""

Start/stop is done as with any startup script

/usr/local/etc/rc.d/yabm.sh start

Help/Usage information

The following options are available, they should probably be self-explained.

yabm 0.2.1 (Yet Another Bandwidth Meter)
Usage ./yabm [-i iface|-a alias] [options]
 -i interface    Interface-based measurement
 -a ipnumber     IP-address based measurement (only AF_INET)
Options
 -s seconds      Calculate average bandwidth over this many seconds (Default 60)
                 60 secs = 1 min/avg, 1 sec = realtime, 300 secs = 5 min/avg
 -o file         Output filename (and path) (Default bw.png)
 -m bits[kmg]    Device max speed (eg. 512k, 100m, 1g, etc) (Default ask device)
 -b hex          Background color (Default c0c0c0)
 -n hex          Incoming bar color (Default 69ff34)
 -u hex          Outgoing bar color (Default 0079b7)
 -w pixels       Image width (Default 640)
 -h pixels       Image height (Default 11)
 -t              Include text display of bandwidth utilization
 -y              Display bytes instead of bits
 -k number       How many markers to draw (Default 3)
 -p file         Pidfile (Default /var/run/yabm.pid)

Example

The above graph (in screenshot) is generated by

yabm -i ed1 -m 512k -o ed1.png -t

FAQ

Q: The image is always blank

A: Well, try to use some bandwidth :)
If you don’t specify the maximum device speed yabm will ask the system and most network interfaces these days are 100Mbps.
And if it’s unable to get something from the system it also will use 100Mbps as max speed.
So with a 100Mbps device you will have to use all your 100Mbps to get a full bar drawn.
If you’re on a capped device, use -m to specify your max speed, eg. 2500k for a 2.5MBps connection or 512k for a 0.5Mbps connection.

Q: Can this be used on other platforms than FreeBSD?

A: Well, it might work for the other *BSDs but that’s nothing I’ve tested
It will probably not run on any other platform without code modifications.

Comments are closed.