Pi-Hole and Smokeping using Same lighttpd Service

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

5 replies on “Pi-Hole and Smokeping using Same lighttpd Service”

When running the command “” echo ‘exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config’ > /var/www/html/smokeping/smokeing.fcgi “” -bash: /var/www/html/smokeping/smokeing.fcgi: Permission denied

I’m not sure how to fix this lol Linux noob here.

This don’t work.. this is not serious !
you can even see a typo at “echo ‘exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config’ > /var/www/html/smokeping/smokeing.fcgi”
This should be “echo ‘exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config’ > /var/www/html/smokeping/smokeping.fcgi”
And even with that it won’t work and will break your pihole lighttpd.

Sorry about the typo – I’ve corrected that and also added a caveat about this being a quick documentation and by no means a concrete guide. Worked on PiHole 4.0 but things have probably changed quite some bit in 5.0

When I type “enable cgi” I get this error:
-bash: enable: cgi: not a shell builtin

I run Debian:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

I can’t find how to install cgi in my debian. When I search on google, I get almost everything Apache and CGI, nothing like lighttpd and CGI.

Can somebody help?

I have pihole installed and it runs.

Leave a Reply