This guide shows how to install and configure Smokeping on Debian Etch 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 a Debian Etch 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.
2 Installing Smokeping
To install Smokeping along with some other recommended packages, we simply run:
apt-get 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. Near the beginning of the file, you find some email settings and the URL of the Smokeping web interface. Change them like this:
[...] # Please edit this to suit your installation owner = Falko Timme contact = email@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 *** Alerts *** to = firstname.lastname@example.org from = email@example.com [...]
(Make sure that mailhost contains the primary MX for your email domain!)
Further down the file, you find the remark line. Modify it to your likings:
[...] 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), www.bbc.co.uk (UK), and web.mit.edu (USA). You should choose different servers to avoid a DOS!
Open /etc/smokeping/config again:
Find the section that begins with ++ Europe. Add a stanza for Germany between it and the Switzerland stanza (which you can comment out if you don’t want to monitor a server in Switzerland):
[...] ++ 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 #+++ Switzerland # #menu = Switzerland #title =Swiss Connectivity #alerts = bigloss,someloss,startloss [...]
Further down, modify the UK stanza as follows:
[...] +++ UK menu = United Kingdom title = United Kingdom ++++ BBC menu = BBC title = BBC host = www.bbc.co.uk [...]
Then change the USA stanza:
[...] ++ 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:
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 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:
3.2 Advanced Example
Until now, we are only pinging servers, but it would be good if we could do some other tests as well (e.g. measure how fast a DNS server resolves a domain or measure HTTP latency). Therefore we open /etc/smokeping/config again and modify the *** Probes *** section.
[...] *** Probes *** + FPing binary = /usr/bin/fping + DNS binary = /usr/bin/dig lookup = domain-to-lookup.com pings = 5 step = 180 + Curl # probe-specific variables binary = /usr/bin/curl step = 60 # a default for this target-specific variable urlformat = http://%host%/ [...]
As you see, we’ve now added tests for DNS (the lookup line should contain a domain/hostname that you’d like the name servers (that we still have to configure in Smokeping) to look up) and HTTP / FTP (using Curl).
Now at the end of /etc/smokeping/config, we can add the name servers / HTTP servers / FTP servers we’d like to monitor (you can enable/disable tests by uncommenting them/commenting them out):
[...] + services menu = Service Latency title = Service Latency (DNS, HTTP) ++ DNS probe = DNS menu = DNS Latency title = DNS Latency +++ dns1 host = ns1.example.com +++ dns2 host = ns2.example.com ++ HTTP probe = Curl menu = HTTP Latency title = HTTP Latency +++ server1 menu = server1 title = HTTP Latency for server1 host = server1.example.com +++ server2 menu = server2 title = HTTP Latency for server2 host = server2.example.com #+++ server3 #menu = server3 #title = HTTP Latency for server3 (port 8080!) #host = server3.example #urlformat = http://%host%:8080/ #++ FTP #probe = Curl #menu = FTP Latency #title = FTP Latency #urlformat = ftp://%host%/ #+++ server1 #menu = server1 #title = FTP Latency for server1 #host = server1.example.com #+++ server2 #menu = server2 #title = FTP Latency for server2 #host = server2.example.com
As you see, we are monitoring the name servers ns1.example.com and ns2.example.com using the DNS probe we’ve configured in the *** Probes *** section. We are also measuring the HTTP latency of server1.example.com and server2.example.com by using the Curl probe. If you like, you can also measure FTP latency using the Curl probe, but make sure that you specify a new urlformat for the FTP section (the default, urlformat = http://%host%/, is configured in the *** Probes *** section; for FTP it should be urlformat = ftp://%host%/).
Restart Smokeping after your changes:
After a few minutes, you should see some data for your new tests in the Smokeping web interface (http://www.example.com/cgi-bin/smokeping.cgi):
You can read up on the Smokeping configuration and further configuration examples here: http://oss.oetiker.ch/smokeping/doc/smokeping_examples.en.html
If you think that Smokeping isn’t working as expected, you can try to find the problem by running Smokeping in debug mode:
- Smokeping: http://oss.oetiker.ch/smokeping/index.en.html
- Debian: http://www.debian.org