
Smokeping is a deluxe latency measurement tool that uses RRDtool to create graphs of latency, latency distribution, and packet loss on a network by measuring packet round-trip times (RTT). Other programs such as NRG or MRTG can also graph single aspects of latency using ping probes, but Smokeping has a number of significant advantages:
A single graph expresses all the characteristics that can be derived from ping packet responses.
In addition to graphing latency using the standard ICMP ping, the latency of network services HTTP, HTTPS, SMTP, DNS and others are monitored using probes that integrate the external utilities echoping, curl, or dig.
Support is provided for probes that perform tasks on monitored devices or hosts to give a combined picture of server availability and network health. For example, probes may report latency for web page downloads or LDAP server authentication.
Email or pager alerts may be sent at predefined thresholds and may use sophisticated "smart alarms" based on latency or loss patterns to reduce or eliminate duplicate alarms.
In Smokeping graphs, the median RTT value is represented by a horizontal colored line, packet loss is represented by the color of the median line, while the RTT distribution (variance) of packets is expressed by successively lighter shades of vertical gray blocks in the background. The gray blocks are called "smoke", and it represents RTT variance. The higher the variance from the mean, the further from the mean line (and lighter) the "smoke." These unique graphs may assist you in discovering network problems or overload by collecting data on packet loss, latency, and complex RTT fluctuations on your network.
Smokeping probes require support from external utilities. Some utilities, such as ssh, rsh, and curl are a part of any standard Unix system. Other utilities, such as fping and echoping are not standard Unix utilities, but they are installed by MacPorts as a part of the Smokeping port install. fping, echoping, and curl are three important utilities that many Smokeping probes are built upon, and it can be useful to get familiar with their operation by using them independently as shown below.
Unlike the standard ping utility, fping sends out multiple ICMP pings concurrently, and tracks the response from each host. You should only ping hosts or sets of IP addresses that you are authorized to probe, because pinging hosts or scanning networks that you do not manage could be viewed as illegal activity. Use fping as shown.
%%fping -e -c 3 192.168.1.1
The "-e" switch shows elapsed RTT, and "-c" gives the number of packets to send. A sample response is below.
192.168.1.1 : [0], 84 bytes, 3.04 ms (3.04 avg, 0% loss) 192.168.1.1 : [1], 84 bytes, 2.11 ms (2.57 avg, 0% loss) 192.168.1.1 : [2], 84 bytes, 2.25 ms (2.46 avg, 0% loss) 192.168.1.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 2.11/2.46/3.04
echoping is used by Smokeping mainly to test http, https, and smtp. Use echoping as shown.
%%echoping -n 3 -h / www.my-webserver.com:80
To test an http service, use the -h option to specify a request for an html page, followed by the path, then the server address and port separated with a colon as shown. The "-n" option may be used to specify the number of pings to send. A sample response is below.
Elapsed time: 0.029058 seconds Elapsed time: 0.023974 seconds Elapsed time: 0.025826 seconds --- Minimum time: 0.023974 seconds (10678 bytes per sec.) Maximum time: 0.029058 seconds (8810 bytes per sec.) Average time: 0.026286 seconds (9739 bytes per sec.) Standard deviation: 0.002000 Median time: 0.025826 seconds (9912 bytes per sec.)
To test SMTP servers, use "-S"
%%echoping -n 3 -S smtp.mycompany.com
While echoping can tell you the response time for http and https pages or failures, curl can give you the text response to an http request. It can use GET or POST commands to send data to a web server, and even authenticate to access protected resources.
%%curl --insecure https://www.secure-server.com
The option "--insecure" keeps curl from using any default certificates. Use "-cacert <CA certificate>" to define a certificate to use for the connection. A sample response is below.
<html> <head> <meta http-equiv="refresh" content="1; URL=https://www.secure-server.com/portal" /> <title>portal</title> </head> <body>portal</BODY>
This section covers installing general support software required for Smokeping.
You may install the MacPorts package manager with these instructions, which include instructions for installing XWindows (X11). Follow the instructions carefully and perform all non-optional steps.
Echoping is installed automatically during Smokeping MacPorts install, but by default it does not have ssl support, so install it separately with the +ssl variant before installing Smokeping as shown.
%%sudo port install echoping +ssl
Here we setup Apple's built-in Apache for Smokeping and SpeedyCGI.
Open a terminal window and copy mod_speedycgi.so to Apple's Apache modules directory.
%%sudo cp ${prefix}/share/doc/speedycgi/mod_speedycgi.so /usr/libexec/httpd%%sudo cp ${prefix}${smokedata}/smokeping.cgi /Library/WebServer/CGI-Executables
Edit the httpd.conf file.
%%sudo pico /etc/httpd/httpd.conf
Add these lines for SpeedyCGI.
LoadModule speedycgi_module libexec/mod_speedycgi.so AddModule mod_speedycgi.c
Uncomment this line to enable CGI execution.
AddHandler cgi-script .cgi
Add an Apache directive for the Smokeping data directory. Locate the default ScriptAlias statement "ScriptAlias /cgi-bin/ ..." and place the directives immediately before it.
Alias /smokeping "/opt/local/var/smokeping" <Directory "/opt/local/var/smokeping"> Allow from all Options ExecCGI </Directory>
The Smokeping web interface uses the file smokeping.cgi, so if you want a simple "/smokeping" url, locate Apache's DirectoryIndex directive and append "smokeping.cgi" to it as shown.
<IfModule dir_module>
DirectoryIndex index.html smokeping.cgi
</IfModule>
Set the Apache user and group. If you use the default Apache user/group "www" as the Smokeping user, no changes are needed.
User <smokeping-user> Group <smokeping-group>
Save and exit httpd.conf and start or restart Apache for the changes to take effect as shown.
Go to System Preferences on the Apple menu.
Click the Sharing icon.
Check the Web Sharing check box, or remove the check and re-check it.
If you chose to install the optional MacPorts Apache 2, you may setup Apache 2 for Smokeping and SpeedyCGI as shown below. Otherwise, skip this section.
Use the Apache 2 sample file.
%%cd /opt/local/apache2/conf%%sudo cp httpd.sample.conf httpd.conf
Edit the httpd.conf file.
%%sudo pico /opt/local/apache2/conf/httpd.conf
Add this line for SpeedyCGI.
LoadModule speedycgi_module modules/mod_speedycgi.so
Uncomment this line to enable CGI execution.
AddHandler cgi-script .cgi
Add an Apache directive for the Smokeping data directory. Locate the default ScriptAlias statement "ScriptAlias /cgi-bin/ ..." and place the directive immediately before it.
Alias /smokeping "/opt/local/var/smokeping" <Directory "/opt/local/var/smokeping"> Allow from all Options ExecCGI </Directory>
The Smokeping web interface uses the file smokeping.cgi, so if you want a simple "/smokeping" url, locate Apache's DirectoryIndex directive and append "smokeping.cgi" to it as shown.
<IfModule dir_module>
DirectoryIndex index.html smokeping.cgi
</IfModule>
Set the Apache user and group. If you use the default Apache user/group "www" as the Smokeping user, no changes are needed.
User <smokeping-user> Group <smokeping-group>
Save and exit httpd.conf and restart Apache 2 for the changes to take effect as shown.
sudo /opt/local/apache2/bin/apachectl restart
Smokeping uses SpeedyCGI to get mod_perl speeds for CGI scripts without special web server modifications. SpeedyCGI is installed during the MacPorts Smokeping install and can adapt itself to the version of Apache you've chosen to use with MacPorts command options, called variants. Apple's Apache is fine for Smokeping unless you want to run Nedi or some other application that requires Apache 2. Perform only one of the sections below to install Smokeping for the Apache version you've chosen.
To install SpeedyCGI and Smokeping (including all dependencies) configured for Apple's built-in Apache, perform this command.
%%sudo port install smokeping +apple_apache
To install MacPorts Apache 2 for the first time, and SpeedyCGI and Smokeping for MacPorts Apache 2, perform the steps below. If you are using MacPorts Apache 2 already, only perform step 1.
First-time MacPorts Apache 2 install.
%%sudo port install apache2%%cd /opt/local/apache2/conf%%sudo cp httpd.conf.sample httpd.conf
To use MacPorts Apache 2, turn off Personal Web Sharing in System Preferences, because you can’t have two versions of Apache running at the same time.
Go to System Preferences on the Apple menu.
Click the Sharing icon.
Remove the check from the Web Sharing check box to disable Apple's built-in Apache.
Start Apache 2 and set it to run at system boot.
%%sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
Test the Apache 2 installation with a web browser at http://localhost/. It should respond with the browser page text "It works!"
To install SpeedyCGI and Smokeping (including all dependencies) configured for MacPorts Apache 2, perform this command.
%%sudo port install smokeping
Smokeping keeps all configuration information in a single file with a tree-like structure called "config." Customize the sections shown below to appropriate values for your installation.
Smokeping logging uses the Unix syslog facility. Setup syslog for Smokeping as shown.
Add a statement to /etc/syslog.conf
local1.* /opt/local/var/smokeping/log/smokeping.log
Create a log file to accept logging messages.
%% cd /opt/local/var/smokeping/log %% sudo touch smokeping.log %% sudo chmod 600 smokeping.log %% sudo chown root:admin smokeping.log
Restart the syslog facility.
%%sudo kill -HUP `cat /var/run/syslog.pid`
Here we set the Smokeping data directory permissions and rename the sample config file for use. to match the Apache user/group you intend to use.
Rename the sample config.dist file to "config" to activate it.
%%cd /opt/local/etc/smokeping%%sudo cp config.dist config%%sudo pico config
Set the owner, contact, mail host, and alerts variables to appropriate values for your installation.
Set the DNS names for the Smokeping config file url's "imgurl" and "cgiurl" to the correct DNS domain name to your Smokeping workstation. But you should leave all file paths alone -they are set by MacPorts.
imgurl = http://myhost.mycompany.edu/smokeping cgiurl = http://myhost.mycompany.com/smokeping/smokeping.cgi
Set the Smokeping data directory owner to match the user/group set in your Apache httpd.conf file.
%%sudo chown -R <smokeping-user>:<smokeping-group> /opt/local/var/smokeping/
The default Smokeping config file has the fping probe's binary path defined. For some reason, Smokeping's fping probe perl module doesn't use defaults so it must be set in config. The default binary paths in the other Smokeping perl modules should be fine so you needn't set them explicitly in config.
*** Probes *** + FPing binary = /opt/local/sbin/fping
You may define other probes types as shown. Definitions for echoping, and dig are shown. It is better to use fewer than the default 20 pings for web servers to not over stress them.
+ EchoPingSmtp # SMTP (25/tcp) for mail servers pings = 5 + EchoPingHttp # HTTPS (443/tcp) for web servers pings = 5 + EchoPingHttps # HTTP (80/tcp) for web servers and caches pings = 5 + DNS binary = /usr/bin/dig
Probe-specific variables - Every probe supports at least some probe-specific variables. The values of these variables are common to all the targets of the probe, and they can only be configured in the Probes section.
Target-specific variables - These variables can be defined for each target and may be configured in both Probes and Targets sections. Values assigned in the Probes section become default values that can be overridden in the Targets section. Most probes support target-specific variables, though fping is an exception. See the probe documentation.
Delete the example targets from the default config file. See examples in /opt/local/share/doc/smokeping.
*** Targets ***
+ My Web Server
menu = MyWebServer
title = My Web Server
host = mywebserver.mydomain.com
alerts = bigloss,someloss,startlossThe tree structure of the target section will determine the organization of the graph links on the Smokeping web page. The top-level sections have a single "+", while their subsections have "++", "+++", etc for progressively deeper levels. You may set the probe type at the top level (which becomes the default,) and override it when necessary at a parent level of the tree or at the host level as necessary. See the following example and the Smokeping config examples.
*** Targets *** menu = top title = Network Latency Grapher remark = Welcome to this SmokePing website + Campus probe = FPing # This will serve as the default fprobe for the campus menu = Biola Campus title = Campus Links ++ CampusBuildings menu = Campus Buildings title = Campus Buildings alerts = bigloss,someloss,startloss +++ Building-1-MDF menu = Building 1 title = Building 1 host = 10.10.10.5 +++ SmithHallMDF menu = Smith Hall title = Smith Hall host = 10.10.10.6 ++ WebServers probe = EchoPingHttp menu = Web Servers title = Web Servers +++ MainWebServer menu = main.mycompany.com host = main.mycompany.com +++ MarketingWebServer menu = marketing.mycompany.com host = marketing.mycompany.com + WANLinks menu = WAN Links title = WAN Links ++ Chicago menu = Chicago Site title = Chicago Site host = 10.10.10.9
When you have all the probes you want to use defined, and monitored hosts and devices organized in the config tree as you want them to appear on your Smokeping web page you may check the Smokeping config file syntax with the Smokeping executable using the --check option as shown.
&&smokeping --check
Correct errors and repeat the command until you see "OK" as shown.
Configuration file '/opt/local/etc/smokeping/config' syntax OK.
Once you've tested your Smokeping config file for errors, you may start Smokeping. Smokeping may be run manually or set to run at system boot with LaunchD. For continuous Smokeping operation, you'll want to run Smokeping using LaunchD.
Start Smokeping manually using this command.
%%smokeping
Using LaunchD
%%sudo launchctl load -w /Library/LaunchDaemons/org.macports.smokeping.plist
Restart Smokeping when config file changes are made.
%%smokeping --restart
You may check for a running Smokeping process with the Unix ps command.
%%ps -ax |grep smoke
If Smokeping is running, the ps command will display results similar to what follows.
1713 Ss 0:00.16 /opt/local/bin/smokeping [FPing] 1753 Ss 0:00.18 /opt/local/bin/speedy_backend -w ../smokeping/smokeping.cgi 1754 S 0:01.56 /opt/local/bin/speedy_backend -w ../smokeping/smokeping.cgi
Make sure to set owner of your Smokeping data directory to match the Apache user and group so you will be able to view the Smokeping data in your web browser. The Apache user/group is set in httpd.conf and the default is www/www.
%%sudo chown -R /opt/local/var/smokeping
Check the Smokeping webpage at http://localhost/smokeping. The Smokeping webpage displays two types of Smokeping graphs: overview graphs and detail graphs.
Overview graphs, as shown in the example below, are displayed when you click on a subtree of the target tree defined in your Smokeping config file.

Detail graphs are graphs of individual services for periods of 3 hour, 30 hour, 10 day, and 400 days. When you click on a graph from the list of overview graphs, you'll see a detail graph for the host or serice that you clicked. The example below shows the top part of a detail graph page showing the 3 hour and 30 hour graphs.

Be sure to read the Smokeping documentation to fully understand its capabilities. To obtain support, see the Smokeping support page to get information about the mail list and list archives. Be sure to search the list archives to see if your question has already been asked before mailing the list.