In this article we are going to setup smokePing to keep track of our network with latency monitoring. It can measure, store and display latency, latency distribution and packet loss. It comes with highly configurable alerting system and live latency charts and interactive graph explorers. Smokeping is not limited to testing just the roundtrip time of the packets. It can also perform some task at the remote end ("probe"), like download a webpage. This will give a combined 'picture' of web server availability and network health.
SmokePing is an open source packets monitoring tool which comes with an easy installation and configurations. On a fresh Ubuntu 15.04 with its minimal installation we only need to get the basic web server’s libraries as its prerequisites.
Installing SmokePing and Pre requisites
The recommended webserver for smokePing is Apache, but we will setup and prefer with Nginx over Apache for performance and scalability.
So, First install Nginx web server with fcgiwrap and sendmail packages as below.
root@ubuntu-15:~# apt-get install nginx
root@ubuntu-15:~# apt-get install sendmail
root@ubuntu-15:~# apt-get install fcgiwrap
root@ubuntu-15:~# apt-get install smokeping
Fcgiwrap Setup with Nginx
Nginx can't serve CGI scripts by itself, so it requires a CGI server bound to localhost in order to make those accessible. Thats why we are using Fcgiwrap here for this.
root@ubuntu-15:~# cp /usr/share/doc/fcgiwrap/examples/nginx.conf /etc/nginx/fcgiwrap.conf
Now modify the host you want or we can use the default host to support cgi scripts as follow.
#fast cgi support
location ~ \.cgi$
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
By using below commands we create links from smokeping to www folder.
root@ubuntu-15:~# ln -s /usr/share/smokeping/www /var/www/smokeping
root@ubuntu-15:~# ln -s /usr/lib/cgi-bin/smokeping.cgi /usr/share/smokeping/www/smokeping.cgi
Once smokeping is running, it will generate rrd files that can be examined by the CGI scripts to produce html output.
After we had successful installation of basic packages, we move forward to configure its different files for monitoring hosts as follow.
Edit General Config file
root@ubuntu-15:~# vim /etc/smokeping/config.d/General
owner = Linoxide
contact = email@example.com
mailhost = localhost
# NOTE: do not put the Image Cache below cgi-bin
cgiurl = http://172.25.10.172/cgi-bin/smokeping.cgi
# specify this to get syslog logging
syslogfacility = local0
# concurrentprobes = no
Edit Pathnames file
Put the value as false for sendmail so that smoke ping can run if you are not using it.
root@ubuntu-15:~# vim /etc/smokeping/config.d/pathnames
sendmail = /bin/false
imgcache = /var/cache/smokeping/images
imgurl = ../smokeping/images
datadir = /var/lib/smokeping
piddir = /var/run/smokeping
smokemail = /etc/smokeping/smokemail
tmail = /etc/smokeping/tmail
Edit Alerts file
root@ubuntu-15:~# vim /etc/smokeping/config.d/Alerts
*** Alerts ***
to = firstname.lastname@example.org
from = email@example.com
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
Edit the Targets file
Here we Add the targets that will measure by appending them to the bottom of the targets file. We add an entry starting with a + to create a top level entry, and subsequent lines with ++ that will show up as sub entries. These will be show up in a menu on the left of the generated web page like so:
*** 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.
menu = Local
title = Local Network
#parents = owner:/Test/James location:/
menu = Local Machine
title = This host
host = localhost
#alerts = someloss
menu = Linoxide
title = Linoxide
menu = Linoxide Web
title = Linoxide Web
host = linoxide.com
Restart smokeping and Nginx Web server
root@ubuntu-15:~#service smokeping restart
root@ubuntu-15:~#service nginx restart
Access smokeping on web
Understanding smokePing Latency
All the information together gives an indication of network health. For example, packet loss is something which should not happen out of the blue. It means that a device in the middle of the link is overloaded or a router configuration somewhere is wrong.
Heavy fluctuation of the RTT (round trip time) values also indicate that the network is overloaded. This shows on the graph as smoke; the more smoke, the more fluctuation.
We have successfully setup and activate smokePing on Ubuntu by using Nginx Web Server. SmokePing is the basic open source network latency monitoring tool that every network administrator prefer to setup after its network setup.