From QNAPedia
Revision as of 10:04, 26 October 2015 by Glenn (talk | contribs) (+Category:Adding new optware services)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation guide for Smokeping on a QNAP NAS.

Please note that the following disciplines will be touched;

  • Minimum Linux shell skills via SSH/Telnet session.
  • Compiling from source
  • Editing custom virtual hosts under Apache

What is Smokeping

Smokeping is a tool that will graph network latency.

Smokeping sample graph


The installation of smokeping requires quite a few pre-requisites as well does fping. 

Downloading and installing Optware

Please follow the Optware guide to have Optware installed on your NAS first.

Installing the Optware pre-requisites

Update your ipkg repository before installing

# ipkg update

Next install the files required to compile sources on your QNAP

# ipkg install optware-devel gawk perl

Downloading Smokeping

Go to and download the latest version of smokeping. Smokeping is also dependent on fping for it probing. We will need to compile a binary of fping as well. At the creation date of this Wiki page the latest versions are Smokeping 2.6.8 and Fping 2.4.b2

Download the files in a temporary area on your QNAP (eg. /share/Public/tmp) and uncompress the tarballs.

# cd /share/Public
# mkdir tmp
# cd tmp
# wget
# tar zxvf smokeping-2.6.8.tar.gz

Repeat the same for fping;

# wget
# tar zxvf fping-2.4b2_to4-ipv6.tar.gz

Building the Perl modules and Fping executable

Before Smokeping can be compiled it will require a few Perl pre-requisites. To install these pre-requisites run the following;

#  cd /share/Public/tmp/smokeping-2.6.8/setup
#  ./

Now we can start building smokeping;

# export LC_ALL=
# export PERL5LIB=/opt/lib/perl5/5.10.0
# export PATH = /opt/bin:/opt/sbin:$PATH
# cd ..
# ./configure --prefix=/opt
# make install

Before configuring smokeping we still need to configure and compile fping from source;

# cd /share/Public/tmp/ fping-2.4b2_to4-ipv6
# ./configure --prefix=/opt
# make install

Preparing Apache

Please make sure you have a virtual host configuration in place as described in this HOWTO

For security reasons the virtual host configuration will require that the script alias is not physically located below the document root of the Apache host. A typical folder structure looks something like this;


  • Copy the smokeping.fcgi file from the /opt/local/smokeping/htdocs folder to your /cgi-bin folder of your virtual host
  • Copy the cropper folder from the /opt/local/smokeping/htdocs folder to your htdocs folder of your virtual host
  • Create a folder called imgcache in your htdocs folder of your virtual host

Make sure the folders all have the permssions set so the Apache user can write files in the imgcache folder. E.g.  

# chown -R httpdusr:administrators /share/MD0_DATA/vhosts/

Edit the smokeping.fcgi file in your cgi-bin folder to have the following content;

/opt/local/smokeping/bin/smokeping_cgi /opt/local/smokeping/etc/config

Setting the Apache Directives

The QNAP Apache configuration does not support CGI executables out of the box, to add support for CGI execution add the following directives to your customized.conf in the appropriate vhost section below your last </Directory> closing tag. Edit paths where necessary.

AddHandler cgi-script .fcgi .cgi .pl
Options +ExecCGI
ScriptAlias /cgi-bin/ /share/MD0_DATA/vhosts/

<Directory /share/MD0_DATA/vhosts/>
Options +ExecCGI -Indexes
Order allow,deny
Allow from all

To reflect the changes made restart the Apache daemon;

# /etc/init.d/ restart

Configuring Smokeping

For smokeping to run properly a few directories need to be created; 

# mkdir -p /opt/local/smokeping/data
# mkdir -p /opt/local/smokeping/logs
# mkdir -p /opt/local/smokeping/var

Then copy the distributed configuration example from etc folder;

# cp /opt/local/smokeping/etc/config.dist /opt/local/smokeping/etc/config

Comment out the syslog feature in the /opt/local/smokeping/etc/config file with a # sign;

#syslogfacility = local0

Edit the paths accordingly to your needs;

imgcache = /share/MD0_DATA/vhosts/
imgurl = /imgcache
datadir = /opt/local/smokeping/data
piddir = /opt/local/smokeping/var
cgiurl =

Make sure the imgcache folder is writeable by the Apache user.

Point the FPing binary to its proper path;


binary = /opt/sbin/fping

Sample probe menu;

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website.

+ provider
title = Provider targetted hosts for tracking quality of overall latency in their network

++ gateway
host =
++ smtp
host =
++ primarydns
host =
++ secondarydns
host =

Fixing the default template

The default template located in /opt/local/smokeping/etc will try to load the cropper javascript from a relative location (eg. /cgi-bin/). This needs to be changed to the Apache document root of the virtual host we are connecting to.

Edit the /opt/local/smokeping/etc/basepage.html.dist and alter the following lines;

<script src="cropper/lib/prototype.js" type="text/javascript"></script>
<script src="cropper/lib/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
<script src="cropper/cropper.js" type="text/javascript"></script>
<script src="cropper/smokeping-zoom.js" type="text/javascript"></script>


<script src="../cropper/lib/prototype.js" type="text/javascript"></script>
<script src="../cropper/lib/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
<script src="../cropper/cropper.js" type="text/javascript"></script>
<script src="../cropper/smokeping-zoom.js" type="text/javascript"></script>

Testing your probes

To run the smokeping perl script properly you need to clear the LC_ALL variable to prevent conflicts. The final script that will launch the daemonized version of smokeping will have this declaration included in the script.

To manually do this to enable debugging and testing your scripts you can;

# export LC_ALL=
./opt/local/smokeping/smokeping --config=/opt/smokeping/etc/config --debug

Once everything runs to wish you can create a script that daemonizes the process;

# touch /opt/bin/
# chmod 755 /opt/bin/ should contain;


export LC_ALL=
cd /opt/local/smokeping/bin
./smokeping --config=../etc/config --logfile=/opt/smokeping/logs/smoke.log


Q: There are no graphs yet, what is going on?
A: The tool updates in intervals of 5 minutes, please give it some time to populate it with data

Q: I have added a new host on the config file while the daemon was running, now it won't update the graph for the new host
A: Terminate the current smokeping process and start the script again


Additional reading

For more information about smokeping and the command-line switches of the script please go to [1]