Smokeping is an open-source network latency monitoring tool created by Tobias Oetiker (the same author as MRTG). It measures, records, and graphically displays network latency, packet loss, and jitter over time.
Smokeping sends repeated pings (ICMP, TCP, HTTP, or other probe types) to a set of targets and stores the results in RRD (Round Robin Database) files. It then generates time-series graphs showing:
- Median latency (how long packets take to return)
- Packet loss (percentage of lost probes)
- Jitter (variation in response times)
In this blog post we will install simple implementation of Smokeping to test quality of internet line.
Installation of MSMTP
Smokeping is able to send e-mails. I use Google Mail (Gmail) and for sending e-mails I will use msmtp plugin configured to use Gmail as a SMTP server.
Here is the procedure how to install msmtp ...
pkg install msmtp
Below is the configuration file
# Default Gmail configuration
defaults
auth on
tls on
tls_trust_file /usr/local/share/certs/ca-root-nss.crt
logfile /var/log/msmtp.log
account gmail
host smtp.gmail.com
port 587
from david.pasek@gmail.com
user david.pasek@gmail.com
password xxxx xxxx xxxx xxxx
account default : gmail
We should change privileges of configuration file to allow read just to root, because we have credentials within the file.
chmod 600 /usr/local/etc/msmtprc
That's it. msmtp installation is done and below is the simple one-liner to send e-mail from command line to my Gmail address ...
echo -e "Subject: Smokeping test\n\nThis is a test from msmtp on FreeBSD." | /usr/local/bin/msmtp -a gmail david.pasek@gmail.com
This one-liner validates that e-mails can be sent from FreeBSD successfully via msmtp.
Installation and configuration of SmokePing
Now we can install smokeping.
pkg install smokeping
and enable it in /etc/rc.conf
sysrc smokeping_enable="YES"
Configuration files of smokeping is in directory /usr/local/etc/smokeping
The most important config file is /usr/local/etc/smokeping/config. Let's create one which works for me.
owner = David Pasek
contact = david.pasek@gmail.com
mailhost = /usr/local/bin/msmtp
imgcache = /usr/local/var/smokeping/images
imgurl = /smokeping/images
datadir = /usr/local/var/smokeping
piddir = /usr/local/var/smokeping
smokemail = /usr/local/etc/smokeping/smokemail
tmail = /usr/local/etc/smokeping/tmail
cgiurl = http://localhost/cgi-bin/smokeping.cgi
# specify this to get syslog logging
syslogfacility = local0
*** Alerts ***
to = david.pasek@gmail.com
from = david.pasek@gmail.com
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 300
pings = 20
# consfn mrhb steps total
AVERAGE 0.5 1 28800
AVERAGE 0.5 12 9600
MIN 0.5 12 9600
MAX 0.5 12 9600
AVERAGE 0.5 144 2400
MAX 0.5 144 2400
MIN 0.5 144 2400
*** Presentation ***
template = /usr/local/etc/smokeping/basepage.html
htmltitle = yes
graphborders = no
# If enabled, treat all filter menu queries as literal strings instead of regex
literalsearch = no
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours" 3h
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 360 Days" 360d
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
#*** Slaves ***
#secrets=/usr/local/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#@+slave2
#display_name=another
#color=00ff00
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. \
Here you will learn all about the latency of our network.
+ Test
menu= Targets
++ GoogleDNS
menu = Google DNS
title = Google DNS
alerts = someloss
host = 8.8.8.8
++ CloudflareDNS
menu = Cloudflare
title = Cloudflare DNS
alerts = someloss
host = 1.1.1.1
Create directory for images
Start smokeping service
service smokeping start
Install web server to access SmokePing outputs
Smokeping has Fast CGI scripts and web app to show its graphs generated by RRDtool. We need some http server. Let's use Apache 2.4
Install and enable apache web server
Install FastCGI
pkg install ap24-mod_fcgid-2.3.9
Edit apache configuration file /usr/local/etc/apache24/httpd.conf to set ServerName, load FastCGI module by adding following lines ...
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Add to the end of apache configuration file /usr/local/etc/apache24/httpd.conf to exposes SmokePing at http://r1.tep.uw.cz/smokeping/
# SmokePing FastCGI setup
<IfModule fcgid_module>
# Adjust this to your actual Smokeping paths
Alias /smokeping "/usr/local/smokeping/htdocs"
<Directory "/usr/local/smokeping/htdocs">
Options ExecCGI FollowSymLinks
AllowOverride None
Require all granted
AddHandler fcgid-script .fcgi
DirectoryIndex smokeping.fcgi
</Directory>
# Optional tuning (timeouts etc.)
FcgidIOTimeout 45
FcgidConnectTimeout 15
</IfModule>
<Directory "/usr/local/var/smokeping/images">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Prepare Fast CGI script by following command
Start Apache web server
service apache24 start
Check that Web Server works by opening URL http://r1.tep.uw.cz/ in web browser.
Smokeping daemon runs as user smokeping and Apache runs as user www, therefore we have to adjust smokeping directory permissions to allow both users read, write and execute in directory /usr/local/var/smokeping
chown -R smokeping:www /usr/local/var/smokeping
chmod -R 775 /usr/local/var/smokeping
Restart both services ...
service smokeping restart
service apache24 restart
Use SmokePing
Now verify that smokeping web works as expected by opening URL http://r1.tep.uw.cz/smokeping/ in your web browser.
You should see something like this ...
![]() |
| SmokePing Web |
Conclusion
SmokePing is nice tool to understand Median latency (how long packets take to return), Packet loss (percentage of lost probes), and Jitter (variation in response times). In this blog post we have just demonstrated how to install, configure and, use SmokePing in FreeBSD 14.3.
Hope you find this useful.

No comments:
Post a Comment