Networking

Monitor network latency using a free tool called SmokePing

As an administrator, you probably often hear complaints about the network being slow. You need an accurate way to get a baseline of network performance and measure that against conditions at any point in time. That's where SmokePing can be very valuable.

Like most administrators, you've probably received a call from a user complaining that the network was "slow." The good news is that now you can monitor network latency, set alarm thresholds, and resolve problems before your users complain. Understanding your network, its performance, and its problems often requires a suite of tools that allows you to examine various aspects of your network. These tools provide solid data that let you baseline your network, troubleshoot problems, and measure anomalies and improvements.

SmokePing is a valuable tool for Linux/UNIX and is similar to the Multi Router Traffic Grapher (MRTG). SmokePing measures the latency and packet loss of your network and also has alarm features that can be configured to provide real-time notifications, as well as historical data. You can use it to monitor WAN interfaces or LAN destinations.

SmokePing is an excellent freeware product written by Tobi Oetiker. It relies on his powerful RRD TOOL, which is a Round Robin Database back end that provides easy-to-use, fast, compact, time-based data collection and display capabilities. The output of SmokePing is an easily modifiable .html file. Figure A shows sample output.

Figure A


The different colors are a function of packet loss. Green means life is good; red means you've got troubles. Other graphs also report your median ping times as well as average packet loss (Figure B).

Figure B


How to install SmokePing
You can install SmokePing on virtually any Linux/UNIX system. I'm currently running my setup on a Red Hat Linux 7.3 system that has the Apache Web server and Perl 5.6.1. It takes only a few minutes for the well-seasoned Linux user to install, but true novice users may need some assistance or guidance from a Linux administrator. This guide is basic enough to get you going in either case. The first thing you need to do is install the programs that provide the back-end support for SmokePing. A minimal setup would consist of RRDtool, FPing, and SpeedyCGI.

RRDtool
RRDtool will install and configure itself in the /usr/local/rrdtool-version directory, so download your file to a different directory to prevent files from being overwritten. Download the file here. Next, untar the file and install it by using these commands:
gunzip rrdtool-1.0.33.tar.gz
tar –xvf rrdtool-1.033.tar
sh configure
make
make install

FPing
Download the file here, then untar the file and install it by using these commands:
gunzip fping-2.4b2_to.tar.gz
tar –xvf fping-2.4b2_to.tar
./configure
make
make install

SpeedyCGI
Download the appropriate file based on your OS platform from here. I just installed the basic distribution. After downloading, run the RPM by using this command:
rpm -1 <filename>

In my case, this filename was RedHat-7.3-speedycgi-2.21-1.i386.rpm. If you don't have a Web server and a Perl module already installed on your system, you'll need to load them as well. You can find detailed instructions here.

SmokePing module
Now you're ready to load the SmokePing module. You'll find the binary file here. Download it and run the following commands:
gunzip smokeping-1.20.tar.gz
tar –xvf smokeping-1.20.tar

After unpacking the files, you need to rename the .dist files by dropping the .dist. For example, smokeping.dist should be just smokeping, and smokeping.cgi.dist should be smokeping.cgi.

Configure SmokePing for your environment
Once you've renamed the files, you're ready to configure the package for your system. You'll need to modify five files to accomplish this task. The modifications are minimal and fairly straightforward, though, with most of the changes consisting of tweaking file paths, configuring your specific user data, such as your name, and adding the host information (IPs or hostnames) for the equipment you want to monitor.

Here are the files you need to change:

bin/smokeping
You need to change the file paths to reflect how you have your system built.

The original configuration will look like this:
#!/usr/sepp/bin/perl –w
use lib qw(/usr/pack/rrdtool-1.0.40-ds/lib/perl);
use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
Smokeping::main("/home/oetiker/.smokeping/config");

I installed my SmokePing files in /usr/local, so here is what my modifications look like:
#!/usr/bin/perl –w
use lib qw(/usr/local/rrdtool-1.0.33/lib/perl);
use lib qw(/usr/local/smokeping-1.20/lib);
Smokeping::main("/usr/local/smokeping-1.20/etc/config");

htdocs/smokeping.cgi
Here again you need to change the file paths. In fact, the changes are identical to the bin/smokeping changes with the exception of pointing to your SpeedyCGI application. After making these changes, move the file to your cgi-bin folder for your Web server. In my case, the new location was /var/www/cgi-bin. The command to do this is mv smokeping.cgi /var/www/cgi-bin.

The original configuration looks like this:
#!/usr/sepp/bin/speedy –w
use lib qw(/usr/pack/rrdtool-1.0.40-ds/lib/perl);
use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
Smokeping::main("/home/oetiker/.smokeping/config");

My modifications look like this:
#!/usr/bin/speedy –w
use lib qw(/usr/local/rrdtool-1.0.33/lib/perl);
use lib qw(/usr/local/smokeping-1.20/lib);
Smokeping::main("/usr/local/smokeping-1.20/etc/config");

etc/config
While most of the necessary changes for this file are fairly obvious, some can be a bit confusing, so I've presented only my modifications here for your reference. I set up my .html files under /var/www/html by creating a directory named smokeping and then set up a subdirectory called img. I also created a /var directory under my smokeping folder as the directory for holding the data files. The URL pointers reflect the IP address of my server. Here are the resulting modifications:
imgcache = /var/www/html/smokeping/img
imgurl = http://192.168.1.101/smokeping/img
datadir = /usr/local/smokeping-1.20/var
piddir = /usr/local/smokeping-1.20/var
cgiurl = http://192.168.1.101/cgi-bin/smokeping.cgi
smokemail = /usr/local/smokeping-1.20/etc/smokemail

etc/basepage.html
This is the main .html file that you'll access. You need to modify it and then move it to your Web server. One thing to note here is that anything with the basic structure of <##text##> is a variable that is passed between files. Do not directly modify anything with this structure in the .html file. Also, there is a link to the SmokePing home page and credits to Tobi Oetiker. You should not remove or modify these, out of respect to the creator of this free tool. Other than that, you can make any changes you want.

Start with the basics, such as changing the title, background colors, and adding your company logo. Then you can get into the finer points of changing how the graphs are displayed. There are many variables that you can easily tweak to your liking.

etc/smokemail
This file is used for the dynamic host function. Not many changes are needed for this file to work.

Further information
The SmokePing site has additional details about each file and the necessary changes if you need more information. There is also a mailing list and lots of archived questions that you can reference if you have any problems installing, configuring, or using this tool.

Starting the application
Once you have everything configured and ready to use, the command to start SmokePing on your Linux/UNIX system is:
./bin/smokeping

When you have the basics working, you can begin to utilize the more advanced features, such as alarm and notification, and dynamic system monitoring and profiling.

Summary
I think you'll find that this freeware tool will provide you with valuable data and insight to your network's performance. You can use it as part of your troubleshooting and monitoring suite of tools, establishing a baseline for your network performance, justifying changes, and then measuring improvements. And, the next time a user reports a slow network, not only will you already know whether you really have a problem, but you'll also have data to support your case.

 
2 comments

Editor's Picks