Pi-Hole and Smokeping using Same lighttpd Service

December 9, 2019

I was having random – or not so random – internet dropouts on a 4G WiFi router. I wanted to ascertain when they occur and if it’s internal wireless or WAN to troubleshoot. smokeping is an old but useful tool to capture this as it sits in the background constantly pinging pre-defined servers.

Since I had a Pi-Hole on the network, this seemed the best tool. Getting the web-portal up and running requires some tinkering however to run as part of the existing Pi-Hole lighttpd web server.

Turns out the correlation is with trains and rush hour! I live near a train station and as a train comes to the station at peak times, the contention ratio on the 4G mast must go through the roof and my internet crawls…Either that or the electric train lines are EMC bandits!

Warning: Steps below worked on PiHole 4.0 and were captured post-process for my own documentation; it is not a concrete guide and some system knowledge is probably required

Install Smokeping

sudo apt install smokeping

Smokeping Setup With Pihole Lighttpd

# enable cgi
sudo ln -s /usr/share/smokeping/www /var/www/html/smokeping
sudo cp /var/www/html/smokeping/smokeping.fcgi.dist /var/www/html/smokeping/smokeping.fcgi
echo 'exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config' >> /var/www/html/smokeping/smokeping.fcgi

Setup Fast cgi /etc/lighttpd/conf-available/10-fastcgi.conf

fastcgi.server += (
  "smokeping.fcgi" => ((
    "socket"   => "/var/run/lighttpd/fcgi.socket",
    "bin-path" => "/usr/share/smokeping/www/smokeping.fcgi"
sudo lighttpd-enable-mod fastcgi
sudo /etc/init.d/lighttpd force-reload

Check Route


Redirect Smokeping Route to Fast cgi File

In /etc/lighttpd/lighttpd.conf

$HTTP["url"] =~ "^/smokeping/" {
         url.redirect  = ("^/smokeping/?$" => "/smokeping/smokeping.fcgi")}

Now one can simply navigate to pihole.local/smokeping