Friday 1 May 2015

Howto install smokeping on lighttpd on ubuntu 15.04 linux

Smokeping is a great network and service monitoring tool. But it only configures correctly if you are using apache.

I want to run a very light web server and therefore you need to do some manual configuration to make it work.

1. Install lighttpd.

sudo apt-get install lighttpd

2. Ensure that http://localhost works. You should get page like this:




3. Install smokeping

sudo apt-get install smokeping

4. Enable Lighttpd CGI module

sudo lighttpd-enable-mod cgi

5. Reload Lighttpd

sudo /etc/init.d/lighttpd force-reload

6. Ensure that this link brings up a semi-functional page

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

Icons and graphs probably do not work.



6. Create a directory link in /var/www/ as smokeping to smokeping static page files:

sudo ln -s /usr/share/smokeping/www /var/www/smokeping
7. For some reason, lighttpd base directory is /var/www/html. This needs to be changed to /var/www (which I suspect other packages will be expecting).

Edit /etc/lighttpd/lighttpd.conf

Change this line:
server.document-root = "/var/www/html"

to:

server.document-root = "/var/www"

8. Restart lighttpd and smokeping

sudo /etc/init.d/lighttpd restart
sudo /etc/init.d/smokeping restart

Did you get this?



Update to enable fastcgi.

I don't know what fastcgi is, but compared to cgi is is fast.

On my laptop, it is 5 times faster!

1. Copy smokeping.fcgi.dist as smokeping.fcgi

sudo cp /var/www/smokeping/smokeping.fcgi.dist /var/www/smokeping/smokeping.fcgi

2. Edit smokeping.fcgi to point to your smokeping.cgi script

exec /usr/lib/cgi-bin/smokeping.cgi /etc/smokeping/config

NOTE: my file had smokeping_cgi. This seems to be wrong and must be changed to smokeping.cgi

3. Modify /etc/lighttpd/conf-available/10-fastcgi.conf

Add this:

fastcgi.server += ( 
  "smokeping.fcgi" => ((
    "socket"   => "/var/run/lighttpd/fcgi.socket", 
    "bin-path" => "/usr/share/smokeping/www/smokeping.fcgi"
  ))
)

4. Enable Lighttpd FastCGI module

sudo lighttpd-enable-mod fastcgi

5. Reload Lighttpd

sudo /etc/init.d/lighttpd force-reload

6. This link should now work

http://localhost/smokeping/smokeping.fcgi