Monitoring Network Latency With Smokeping (Ubuntu 9.04)

Version 1.0
Author: Falko Timme
Follow me on Twitter
Last edited 05/22/2009

This guide shows how to install and configure Smokeping on Ubuntu 9.04 to monitor network latency. From the Smokeping web site: "SmokePing is a deluxe latency measurement tool. It can measure, store and display latency, latency distribution and packet loss. SmokePing uses RRDtool to maintain a longterm data-store and to draw pretty graphs, giving up to the minute information on the state of each network connection."

This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I have tested this on an Ubuntu 9.04 system. I will use the hostname www.example.com for this system in this tutorial. We need a web server on the system to display the graphs. I will install Apache2 and use Apache's default vhost for hosting the graphs. If you use a different vhost, you might have to adjust its settings or copy the smokeping.cgi script from /usr/lib/cgi-bin/smokeping.cgi to the appropriate location.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

 

2 Installing Smokeping

To install Smokeping along with some other recommended packages, we simply run:

aptitude install smokeping curl libauthen-radius-perl libnet-ldap-perl libnet-dns-perl libio-socket-ssl-perl libnet-telnet-perl libsocket6-perl libio-socket-inet6-perl apache2

 

3 Configuring Smokeping

The Smokeping configuration is in the file /etc/smokeping/config. This file just includes some other files from the /etc/smokeping/config.d directory so we have to modify these files. First we modify /etc/smokeping/config.d/General. In this file, you find some email settings and the URL of the Smokeping web interface. Change them like this:

vi /etc/smokeping/config.d/General

*** General ***

@include /etc/smokeping/config.d/pathnames

# Please edit this to suit your installation
owner    = Falko Timme
contact  = me@example.com
cgiurl   = http://www.example.com/cgi-bin/smokeping.cgi
mailhost = smtp.example.com
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no

(Make sure that mailhost contains the primary MX for your email domain!)

Open /etc/smokeping/config.d/Alerts and set the correct to and from addresses for emails sent by Smokeping:

vi /etc/smokeping/config.d/Alerts

*** Alerts ***
to = me@example.com
from = smokealert@example.com
[...]

Next open /etc/smokeping/config.d/Targets. In this file, you find the remark line. Modify it to your likings:

vi /etc/smokeping/config.d/Targets

[...]
remark = Welcome to the SmokePing website of 'Example Company'
[...]

 

3.1 Basic Example

We will now do a basic configuration to measure the network latency to certain servers in various countries (e.g. Germany, UK, USA). In this example, I'm going to test the network connection to the servers www.heise.de (Germany), bbc.co.uk (UK), and web.mit.edu (USA). You should choose different servers to avoid a DOS!

Open /etc/smokeping/config.d/Targets again:

vi /etc/smokeping/config.d/Targets

At the end of this file, you should see this:

[...]
+ Local

menu = Local
title = Local Network

++ LocalMachine

menu = Local Machine
title = This host
host = localhost

Add the following lines to the file:

[...]
+ World

menu = World
title = World

++ Europe

menu = Europe
title =European Connectivity

+++ Germany

menu = Germany
title = German Connectivity
alerts = bigloss,someloss,startloss

++++ Heise

menu = Heise
title = Heise
host = www.heise.de

+++ UK

menu = United Kingdom
title = United Kingdom

++++ BBC

menu = BBC
title = BBC
host = bbc.co.uk

++ USA

menu = North America
title =North American Connectivity

+++ MIT

menu = MIT
title = Massachusetts Institute of Technology Webserver
host = web.mit.edu

Save your changes and restart Smokeping:

/etc/init.d/smokeping restart

Smokeping will now probe the servers by pinging them (by using /usr/bin/fping) - this is the default test.

Now open a web browser and go to http://www.example.com/cgi-bin/smokeping.cgi. This is the start page:

After a few minutes you should see the first graphs. This is how the latency of localhost looks (which is configured by default in /etc/smokeping/config.d/Targets unless you changed that):

In the menu on the left side we can now go to the countries/servers that we configured earlier and take a look at their graphs:

Share this page:

5 Comment(s)

Add comment

Comments

From: Peter Hickman at: 2009-07-16 12:34:24

Nice try but the full site names are available in the browser window => ns10.projektfarm.com

Not that it is a problem, how long do you thing a few Xs over the text would have added to finding that information out?

 Just black it out next time

From: Josh Richards at: 2009-10-24 03:55:52

Kris - Uncomment the universe line(s) in /etc/apt/sources.list then "aptitude update" then attempt to install again.

From: Kris at: 2009-10-01 22:32:14

Dear,

 Step 2 in your howto (aptitude install smokeping curl libauthen-radius-perl libnet-ldap-perl libnet-dns-perl libio-socket-ssl-perl libnet-telnet-perl libsocket6-perl libio-socket-inet6-perl apache2) doesn't work with me :

 root@ubuntu:~# aptitude install smokeping curl libauthen-radius-perl libnet-ldap-perl libnet-dns-perl libio-socket-ssl-perl libnet-telnet-perl libsocket6-perl libio-socket-inet6-perl apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Couldn't find any package whose name or description matched "smokeping"
Couldn't find any package whose name or description matched "libauthen-radius-perl"
No candidate version found for libio-socket-ssl-perl
Couldn't find any package whose name or description matched "smokeping"
Couldn't find any package whose name or description matched "libauthen-radius-perl"
No candidate version found for libio-socket-ssl-perl
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Writing extended state information... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done

 

What do i have to edit?

From: Anonymous at: 2012-04-20 23:14:44

How do you configure smokeping to just send 1 email for the packet loss? Maybe it's not possible. We're trying to dial up the samples so that we can trap tiny increments of loss on our WAN. I've dialed the database down to a check every 15 seconds, but if loss occurs it looks like I will get an email every 15 seconds until I get to fixing it or stopping the daemon.

 Any suggestions?

From: VJ at: 2015-03-05 02:27:09

Thank you for the informative Smokeping setup guide.

I followed these steps on an Ubuntu machine, and when I apply "/etc/init.d/smokeping restart", get the following error message:

 * Shutting down latency logger daemon smokeping                         [ OK ]  * Starting latency logger daemon smokeping                          

ERROR: /etc/smokeping/config.d/Targets, line 3: unknown variable 'menu'

My Targets file is simple as follows:

+ Internationalmenu = International serverstitle = International servers++ Yahoomenu = Yahootitle = Yahoohost = www.yahoo.com

Any tips to overcome the error message?