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 ***
binary = /usr/bin/fping
step = 300
pings = 10
binary = /usr/bin/echoping
step = 300
pings = 5
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.
menu = Internet
title = Outbound from the Pi to the Internet (using Ping)
title = Google
menu = Google
host = www.google.com
menu = Measuring DNS response times
title = Name Servers
title = Google public DNS
menu = Google public DNS
probe = EchoPingDNS
dns_request = www.google.com
host = 22.214.171.124
menu = Cloud
title = Response of well known Cloud Services
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.
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.
Next up are the Aliases, click the link in the Virtual Server Options page.
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.
Choose the Configure Apache Modules icon
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.
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:
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.
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.
menu = LabMenu
title = These are hosts for testing Smokeping
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.
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.
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.
In large part, this post owes much of the information to Calomel.org for providing information about this topic, https://calomel.org/smokeping.html.