DEV Community

Tony Metzidis
Tony Metzidis

Posted on • Originally published at tonym.us on

Smokeping On Raspberry Pi Zero

Smokeping is a self-contained network monitoring app , capable of monitoring using ICMP/Ping, HTTP, DNS -- as well as other signals generated from CLI monitoring tools (e.g. curl, dig, mtr etc). It provides a web-based monitoring UI to chart the probe measurements so no further monitoring apps (like Prometheus) are needed.

Running smokeping on a $5 Raspberry Pi Zero is a fun experiment in lightweight computing . Using Apache Mod FastCGI makes the app usable on the meager hardware.

By the end of the exercise you'll have the smokeping probes running to test network performance and the UX available on your local network onhttp://raspberrypi.local/smokeping

Prerequisites

  1. Pi Zero
  2. MicroSD 4GB+
  3. A windows or mac machine to run image installation & configuration
  4. wifi for installing packages

1. Install RaspberryPi OS using the Imager

  1. Download & Install Raspberry Pi Imager
  2. Select RaspberryPi OS Lite 32bit from the Advanced menu
  3. [new] Use the cog / settings menu to enable SSH, set hostname & set WIFI credentials . ⚠️ Don't Skip this step: RaspberryPi OS no longer supports default user credentials.
  4. Write the image to your Micro SD

2. Boot & SSH into the device and update the device (optional)

  1. SSH into the device e.g. ssh pi@raspberrypi.local
  2. update your catalog sudo apt update
  3. (optional ~15min) update your installed packages sudo apt upgrade

3. Install smokeping, apache2 & fastCGI

  1. install apache, smokeping & fast-cgi (to improve loading times) \ $ sudo apt install apache2 fping curl smokeping libapache2-mod-fcgid
  2. enable smokeping $ sudo a2enconf smokeping
  3. restart and test that smokeping default site is working by visiting http://raspberrypi.local/ in your browser

At this point you will see the default smokeping installation with minimal example probes

4 Enable smokeping configuration

  1. activate fastcgi and set smokeping to default by adding this block to/etc/apache2/conf-available/smokeping.conf (after Line 3)
# redirect / to /smokeping 
RedirectMatch ^/$ /smokeping/
# activate fastcgi to improve performance
<Location /smokeping/smokeping.cgi>
    SetHandler fcgid-script
</Location>

Enter fullscreen mode Exit fullscreen mode

5 Edit Targets and Test

Here is the example head of the Targets config to probe your home router

$ head -n 19 /etc/smokeping/config.d/Targets 
***Targets***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of WORKS Company. \
         Here you will learn all about the latency of our network.

+ Home

menu = Home
title = Home

++ Gateway
menu = Gateway
title = Gateway
host = 192.168.1.1

Enter fullscreen mode Exit fullscreen mode

6 Follow Up & Next Steps

At this point your probes should be running regularly and collecting historical measurements.

I recommend adding the following probes

  • Your ISP's first and second HOPs (use traceroute to identify the IP addresses)
  • any streaming services e.g. Netflix, Youtube
  • Assign fixed IPs to your devices like PS4, laptop, phone and probe them in your home to catch performance issues.

Top comments (0)