Installing and configuring SmokePing on a Raspberry Pi

Installing and configuring SmokePing on a Raspberry Pi

These instructions are based from the blogs at MyHomeBroadband.com and kugelfish.com.

Install Smokeping onto the Pi

The nice thing about these steps is they aren’t confined to the Raspberry Pi. You can apply this to any Linux distribution. Open a terminal session and run the following command.

sudo apt-get install smokeping

The downloader has Apache included, however this was setup earlier when Webmin was installed. This appears to be a factor with some settings not being changed.

Once downloaded, and installed, you need to change the config files, such as Targets and Probes . We’ll also need to make some changes to Apache so it loads correctly.

First I changed the Probes config, it can be found in the /etc/smokeping/config.d/ folder. I edit it with the following command.

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

Once the editor opens, I replaced the contents with the following information.

*** Probes ***

+ FPing
binary = /usr/bin/fping
step = 300
pings = 10

+EchoPingDNS
binary = /usr/bin/echoping
step = 300
pings = 5

+EchoPingHttp
binary = /usr/bin/echoping
step = 300
pings = 3

I also verified that the binary arguments above were indeed correct.

Next up, I modified the Targets config by entering in the following command.

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

This brings up the nano editor, in which I replaced the contents with the following.

*** Targets ***

probe = FPing

menu = Top
title = Using a Raspberry Pi and SmokePing to Monitor Networks
remark = Latency to a few select sites and services in the Internet.

+ Internet
menu = Internet
title = Outbound from the Pi to the Internet (using Ping)

++ Google
title = Google
menu = Google
host = www.google.com

+ DNS
menu = Measuring DNS response times
title = Name Servers

++ gdns
title = Google public DNS
menu = Google public DNS
probe = EchoPingDNS
dns_request = www.google.com
host = 8.8.8.8

+ Cloud
menu = Cloud
title = Response of well known Cloud Services

++ CloudACM
title = CloudACM
menu = CloudACM
probe = EchoPingHttp
host = website_address
port = 80
url = /path/sub-path/somefile.txt

There is a sendmail option in the pathnames file that will need to be commented out. This may not be the case for all installs, but it was on mine. I ran the editor using the following command.

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

The following entries were change to these values.

# sendmail = /usr/sbin/sendmail
imgcache = /var/cache/smokeping/images
imgurl = ../smokeping/images
datadir = /var/lib/smokeping
piddir = /var/run/smokeping
smokemail = /etc/smokeping/smokemail
tmail = /etc/smokeping/tmail

You should now have Smokeping installed and configured. Since Apache was installed prior to Smokeping, some settings will need to be changed.

Open up Webmin and go to Servers/Apach Webserver. First, we’ll need to remove any virtual host added from the Smokeping install. This should be the only thing listed.

smokeping_01

Next, open up the Default Server and verify that the Smokeping directoy exists. If it doesn’t, we’ll need to create it at the bottom of the page.

smokeping_02

smokeping_03

 

 

 

 

Next up are the Aliases, click the link in the Virtual Server Options page.

smokeping_04

smokeping_05

 

 

 

 

 

If the alias isn’t listed, enter it in at the next available field.

Next up is setting the cgid service to a running state. For some reason my instance did not have it running. To do this go back to the main Apache Webserver page and select the Global configuration tab.

smokeping_06

 

 

 

 

 

 

Choose the Configure Apache Modules icon

smokeping_07

 

 

 

Scroll down to the cgid check box, select it and scroll to the bottom of the page to the Enable Selected Modules button. Press it to enable the cgid service.

smokeping_08

 

smokeping_09

 

 

To activate all of these changes, it is much easier to reboot the system with Webmin. You can do this by going to System/Bootup and Shutdown and scrolling to the bottom of the page and pressing the Reboot System button. You’ll be prompted again to reboot.

Once the system reboots, type in the following to your favourite web browser:

http:///cgi-bin/smokeping.cgi?

That should be it, you should get a web page up, and some links down the side-click on them. The page should update itself automatically every minute, so no need to refresh. Have a play, leave it for 30 mins or so, and you should see the graphs update themselves.

smokeping_10

Adding targets and modifying existing

It’s difficult to define all the targets at before and during the installation of SmokePing. More often than not, you will want change the hosts you are graphing. Adding new hosts isn’t a difficult task, but there is a caveat when doing so.

First off, the Targets file that defines the host to ping has a structure to it that Smokeping uses to do things in the background. These background processes create RRDs (Round Robin Databases), plot the data from the RRDs into an image file (.png), and represent the image data on a web front end. As you might have seen, the structure of the Targets information is seen on the web front end. Here’s an example of one host defined in the Targets file.

+ Lab
menu = LabMenu
title = These are hosts for testing Smokeping

++ IdentifierIten
title = TitleItem
menu = MenuItem
host = host_ip_address

When looking at the web front end, some of the text entered above appears in the web pages, while other text appears inside the image itself.

smokeping_11

Clicking on the MenuItem drills down to series of historical graphs. The graph above is an overview of the host with minimal information. The graph below has more detail about the host results.

smokeping_12

Since there is a dependency on the target definitions that Smokeping uses to create and process, some guidelines should be followed when defining the hosts in the Targets file.

No spaces in the Title
No special characters, ie. $%&…
Use Camel Case or Underscores, ie. CamelCase, Camel_Case, etc…
Keep them short

If these guidelines are followed, many unusual graphing issues can be avoided.

Credit

In large part, this post owes much of the information to Calomel.org for providing information about this topic, https://calomel.org/smokeping.html.

Comments are closed.