Install and Configure Smokeping on Ubuntu-14.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month. Get a Cloud Server

Introduction

Smokeping is an opensource deluxe latency measurement tool that can be used to measure, store and display latency, latency distribution and packet loss. Using smokeping you can easily keep track of your network with latency monitoring. Smokeping allows you to maintain a longterm data-store and generate statistical charts based on RRDtool's output. In this tutorial, we will learn how to install and configure Smokeping on Ubuntu 14.04.

Requirements

A server runing Ubuntu-14.04.

A non-root user with sudo privileges setup on your server.

Install Smokeping

Before installing smokeping, you will need to install the Nginx web server with fcgiwrap and sendmail as its prerequisites.

You can install all this package by running the following command:

sudo apt-get install nginx sendmail fcgiwrap

Output:

* Starting Mail Transport Agent (MTA) sendmail ^[[B^[[B^[[B [ OK ] Setting up libfcgi0ldbl (2.4.0-8.1ubuntu5) ... Setting up spawn-fcgi (1.6.3-1) ... update-alternatives: using /usr/bin/spawn-fcgi.standalone to provide /usr/bin/spawn-fcgi (spawn-fcgi) in auto mode update-alternatives: warning: not replacing /usr/share/man/man1/spawn-fcgi.1.gz with a link Setting up fcgiwrap (1.1.0-2) ... * Starting FastCGI wrapper fcgiwrap [ OK ] Setting up nginx-common (1.4.6-1ubuntu3.5) ... Setting up nginx-core (1.4.6-1ubuntu3.5) ... Setting up nginx (1.4.6-1ubuntu3.5) ... Setting up procmail (3.22-21ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-16) ... Setting up sensible-mda (8.14.4-4.1ubuntu1) ... Setting up sendmail (8.14.4-4.1ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6) ...

Once installation is complete, start Nginx service and enable it to start at boot with the following command:

sudo /etc/init.d/nginx start

sudo update-rc.d nginx defaults

You should see the following output:

Adding system startup for /etc/init.d/nginx ... /etc/rc0.d/K20nginx -> ../init.d/nginx /etc/rc1.d/K20nginx -> ../init.d/nginx /etc/rc6.d/K20nginx -> ../init.d/nginx /etc/rc2.d/S20nginx -> ../init.d/nginx /etc/rc3.d/S20nginx -> ../init.d/nginx /etc/rc4.d/S20nginx -> ../init.d/nginx /etc/rc5.d/S20nginx -> ../init.d/nginx

Now, you can install smokeping with the following command:

sudo apt-get install smokeping

Output:

Selecting previously unselected package smokeping. Preparing to unpack .../smokeping_2.6.8-2+deb7u1ubuntu0.14.04.1_all.deb ... Unpacking smokeping (2.6.8-2+deb7u1ubuntu0.14.04.1) ... Processing triggers for man-db (2.6.7.1-1) ... Processing triggers for doc-base (0.10.5) ... Processing 1 added doc-base file... Registering documents with scrollkeeper... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Setting up libperl5.18 (5.18.2-2ubuntu1.1) ... Setting up echoping (6.0.2-7) ... Setting up fping (3.8-1) ... Setting up javascript-common (11) ... Setting up libjs-prototype (1.7.1-3) ... Setting up libjs-scriptaculous (1.9.0-2) ... Setting up libjs-cropper (1.2.2-1) ... Setting up perl-modules (5.18.2-2ubuntu1.1) ... Setting up perl (5.18.2-2ubuntu1.1) ... Setting up libconfig-grammar-perl (1.10-1) ... Setting up libfcgi-perl (0.74-1build2) ... Setting up libcgi-fast-perl (5.18.2-2ubuntu1.1) ... Setting up librrds-perl (1.4.7-2ubuntu5) ... Setting up libsnmp-session-perl (1.13-1.1) ... Setting up smokeping (2.6.8-2+deb7u1ubuntu0.14.04.1) ... Adding system user `smokeping' (UID 122) ... Adding new group `smokeping' (GID 132) ... Adding new user `smokeping' (UID 122) with group `smokeping' ... * Starting latency logger daemon smokeping [ OK ] Processing triggers for libc-bin (2.19-0ubuntu6) ... Processing triggers for ureadahead (0.100.0-16) ...

Setting up Fcgiwrap With Nginx

Here you will need to use Fcgiwrap with Nginx to serve CGI scripts. So you will need a CGI server bound to localhost in order to make those accessible.

To configure fcgiwrap, you will need to copy sample fcgiwrap file. You can copy this file with the following command:

sudo cp /usr/share/doc/fcgiwrap/examples/nginx.conf /etc/nginx/fcgiwrap.conf

Next, edit /etc/nginx/fcgiwrap.conf file:

sudo nano /etc/nginx/fcgiwrap.conf

Change the file as shown below:

# Include this file on your nginx.conf to support debian cgi-bin scripts using # fcgiwrap include /etc/nginx/fcgiwrap.conf; location /cgi-bin/ { # Disable gzip (it makes scripts feel slower since they have to complete # before getting gzipped) gzip off; # Set the root to /usr/lib (inside this location this means that we are # giving access to the files under /usr/lib/cgi-bin) root /usr/lib; # Fastcgi socket fastcgi_pass unix:/var/run/fcgiwrap.socket; # Fastcgi parameters, include the standard ones include /etc/nginx/fastcgi_params; # Adjust non standard parameters (SCRIPT_FILENAME) include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib$fastcgi_script_name; }

Now, create links from smokeping to www folder with the following command:

sudo ln -s /usr/share/smokeping/www /var/www/smokeping

sudo ln -s /usr/lib/cgi-bin/smokeping.cgi /usr/share/smokeping/www/smokeping.cgi

Configure Smokeping

Once everything is up-to-date, it's time to configure smokeping and its different files for monitoring hosts as follow.

First, general configuration file:

sudo nano /etc/smokeping/config.d/General

Change the file as shown below:

*** General *** owner = Hostpresto contact = hitjethva@gmail.com mailhost = localhost # NOTE: do not put the Image Cache below cgi-bin # since all files under cgi-bin will be executed ... this is not # good for images. cgiurl = http://192.168.1.16/smokeping.cgi # 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 @include /etc/smokeping/config.d/pathnames

Next change the sendmail value as false in /etc/smokeping/config.d/pathnames file:

sudo nano /etc/smokeping/config.d/pathnames

Add / Edit the file as shown below:

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

Next, you need to edit the alert file:

sudo nano /etc/smokeping/config.d/Alerts

Add / Edit the file as shown below:

*** Alerts *** to = hitjethva@gmail.com from = alert@hostpresto.com +someloss type = loss # in percent pattern = >0%,*12*,>0%,*12*,>0% comment = loss 3 times in a row

Now, configure targets file to monitor different servers. You can do this by editing targets file located at /etc/smokeping/config.d/Targets.

sudo nano /etc/smokeping/config.d/Targets

Change the file as per your requirement:

*** 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. + Local menu = Local title = Local Network #parents = owner:/Test/James location:/ ++ LocalMachine menu = Local Machine title = This host host = localhost #alerts = someloss + My_Web_Server menu = Hostpresto title = Hostpresto ++ Web_Server_1 menu = Hostpresto Web title = Hostpresto Web host = hostpresto.com Save the file, restart Nginx and Smokeping with the following command: `sudo /etc/init.d/nginx restart` `sudo /etc/init.d/smokeping restart`

Access Smokeping Web Interface

Once everything is up-to-date, it's time to access smokeping web interface.

Now, open your web browser and type the URL http://smokeping-server-ip. You should see the following page:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1152094419.png" alt="" />

Next, click on the chart in the top left sidebar, you should see the following page:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1557365360.png" alt="" />