torsdag 7 januari 2010

Smokeping on debian lenny

Smokeping is a tool to monitor network connectivity and visualize it in a very easily readable way.
I had some trouble to get it started - not the smokeping part, but getting the apache configuration going. This is a writeup on what I did to get it going. It is used on Debian Lenny, but should work for ubuntu as well. To lighten up the text, I show one of the graphs I got from it. I can see there was a network disruption for approximtely 20 minutes.

I wrote this by following the material on

Install smokeping:
apt-get install smokeping


(optional)
Configure the interval in /etc/smokeping/config.d/Database as the default values are, in my opinion, a bit to sparse to detect network loss.
step = 30
pings = 3


Delete the statistics database to avoid the error during restart in the next step:
rm /var/lib/smokeping/Local/LocalMachine.rrd


restart smokeping:
/etc/init.d/smokeping restart


add targets in /etc/smokeping/config.d/Targets:
+ dreik
menu=dreik
title=dreik
++ sniiigel
menu=sniiigel
title=sniiigel
host=sniiigel.dreik.se

++ rufus
menu=rufus
title=rufus
host=rufus.paulsundvall.net


restart smokeping to make it start monitoring the newly added entries above (this lets you have some statistics to view, collected while getting the rest to work):
/etc/init.d/smokeping restart


Smokeping should now be running. To be able to see some results you have to run a web server with cgi capabilities. I believe one can generate the content statically instead and serve it as static pages, but I use apache/cgi here.

(Install apache if you have not done already. apt-get install apache2)

One has to edit an existing or create a new apache configuration file. I serve the stats through password protected pages on ssl, this is an excerpt from that file which is /etc/apache2/sites-available/ssl. If you do not care about encryptiong and/or protecting the page, you can set it up using a much shorter configuration file. Just leave out the bits about authentication.
I do not know much about apache configuration and the configuration could probably be improved while obtaining the same or higher security level.

Alias /smokeping/ /var/www/smokeping/

Options -FollowSymLinks
Options -Indexes
AllowOverride None
AuthUserFile /x/y/z/passwords
AuthGroupFile /x/y/z/groups
AuthName "bla da bla smokeping"
AuthType Basic
AuthBasicProvider file
Require group webreaders

Alias /smokepingcgi/ /usr/lib/cgi-bin/

Options +ExecCGI
AddHandler cgi-script cgi
SetHandler cgi-script
Options -FollowSymLinks
Options -Indexes
AllowOverride None
AuthUserFile /x/y/z/passwords
AuthGroupFile /x/y/z/groups
AuthName "bla da bla smokeping"
AuthType Basic
AuthBasicProvider file
Require group webreaders



Then reload the apache configuration with
/etc/init.d/apache2 reload


And voila, I get nice graphs when pointing the browser to the www.myserver.net/smokepingcgi/smokeping.cgi

To get the name right, edit /etc/smokeping/config.d/General to contain your name instead of the default.

Inga kommentarer: