Monitoring network performance with speedometer

8601

Author: Ben Martin

Speedometer shows a graph of your current and past network speed in your console, letting you see your network connection’s up and downstream speed and history at a glance. You can also use speedometer directly on a file to monitor the download performance and history of a specific download instead of all network traffic. When displaying the total network traffic, speedometer is sort of like gkrellm, in that you can see the current and past network performance on a graph, but you can easily run it over an SSH connection without having to set up gkrellmd.

Speedometer is packaged for Ubuntu Hardy and as a 1-Click install for openSUSE 10.3, but is not in the Fedora repositories. For this article I’ll build speedometer version 2.6 from source on a 64-bit Fedora 8 machine.

Speedometer is written in the Python language and uses the Urwid library to display itself in a terminal. If you are building from source you’ll need to install or build Urwid too. Urwid follows the normal Python build and installation using setup.py, as shown below. Speedometer is simply a single Python file and can be directly installed as shown.


$ tar xzvf urwid-0.9.8.2.tar.gz
$ cd ./urwid-0.9.8.2/
$ python setup.py build
$ sudo python setup.py install
$ cd ~
$ tar xzvf speedometer-2.6.tar.gz
$ cd ./speedometer-2.6/
$ sudo install -m 755 speedometer.py /usr/local/bin


The -tx and -rx command-line options are used to monitor all network traffic transmitted and received respectively on a network interface. Shown in the screenshot is the output of the command speedometer.py -tx eth1 -rx eth1. Speedometer will resize and redraw its display when the terminal window is resized, both when running locally in a gnome-terminal and over SSH.

When you use speedometer to monitor a particular download, it monitors a file rather than the network interface. This makes it useful for all sorts of network transfer monitoring: HTTP downloads from the Web, Samba and NFS file transfers, and scp secure transfer monitoring. One piece of information that is not available from monitoring a file is how large that file should become in the end. Without this information, speedometer happily monitors the transfer rate but can give you no indication of how close to done a transfer is. If you supply the optional size parameter, then it will also display a percentage complete bar at the bottom of the window, letting you quickly see the overall transfer progress.

As the example above shows implicitly, you can monitor multiple things at once with speedometer. That means if you have a multihomed host, you can easily keep an eye on multiple network interfaces at once.

The -f option allows you to monitor a file transfer. One glitch I found when monitoring file transfers is that speedometer waits for a file to be created before starting. This inhibits you from keeping an eye on other network traffic in the meantime. Making speedometer able to keep checking whether a file is created in the background while allowing you to see the other things you wish to monitor would be a great addition.

The columned screenshot shows the result of the command below:


speedometer.py -tx eth1
-c -f 'lca08-fixing-xfs-filesystems-faster-mel8-135.ogg'
-c -f foo


When you want to monitor multiple things, you can just keep adding new -tx, -rx, or -f options to the command line, or you can put a -c before the next option to make the graphs stack into columns instead of rows. If you are only monitoring a few things and have a wide screen display, then displaying graphs in columns might be a good idea. You can also create a display with both columns and rows by using -c only where you want to start a new column.

I chose a file with a descriptive long name to see how speedometer handles such cases when monitoring file transfers. It is nice that the graph for the second file transfer retains the same size as the other file transfer graph. Aligned displays like this are usually easier to read.

Speedometer is easy to install and definitely useful if you want to keep an eye on a transfer or network interface on a local or remote machine. Speedometer also plays nicely when you resize your display, in that it not only detects the new size but also redraws the current graph information properly.

Categories:

  • Tools & Utilities
  • System Administration
  • Networking