Smokeping on FreeBSD 7
Thursday, April 24th, 2008This write-up assumes a working copy of FreeBSD 7.0. It was built using 7.0-RELEASE. It should work on FreeBSD 6.x-STABLE and future versions of FreeBSD 7. The package versions listed were current as of this writing but may have been updated by the time someone uses this howto.
This is a basic setup of Smokeping. There are many extra features that I do not touch on here such as multi-target graphs, alerting, slaves, agents and additional probe types. Check the online documentation for further info.
Please let me know if you run into typos or other technical issues when implementing this.
1.) First let’s update the ports collection.
Setup the update:
# cd /usr/ports/ports-mgmt/portupgrade
# make install clean
# cd /usr/ports/net/cvsup
# make install clean
# cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile
# pico /root/ports-supfile
Make it look something like this:
#######################################################
*default host=cvsup1.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix
#comment the below line if you don't want to update the /src directory
#src-all
#update /usr/ports
ports-all tag=.
#######################################################
Run the update:
# cvsup -L 2 /root/ports-supfile
# portsdb -Uu
Update installed ports:
# portversion -l "<"
# portupgrade -arR
# pkgdb -F
2.) Install the necessary packages.
Descriptions of packages and uses here: http://oss.oetiker.ch/smokeping/doc/smokeping_install.en.html
Installed by default with FreeBSD install
# cd /usr/ports/databases/rrdtool
# make install clean
# cd /usr/ports/net/fping
# make install clean
# cd /usr/ports/net/echoping
# make install cleanInstalled by default with FreeBSD install
Socket6
# cpan
# install Socket6
Net:DNS
# install Net::DNS
# quit
# cd /usr/ports/www/apache22
# make install clean
# cd /usr/ports/www/p5-CGI-SpeedyCGI/
# make install clean
# cd /usr/ports/net-mgmt/smokeping
# make install clean
3.) Configure the packages.
# pico /usr/local/etc/apache22/httpd.conf
Add:
(within the <IfModule alias_module> section)
<Directory "/usr/local/smokeping/htdocs">Add:
(within the <IfModule dir_module> section)
Add smokeping.cgi after index.html on the DirectoryIndex line to allow smokeping.cgi to load as a default document.
It should look like:
DirectoryIndex index.html smokeping.cgiAllow the startup of Apache:
Add the following to /etc/rc.conf
apache22_enable="YES" # enable Apache 2.2Start Apache:
# /usr/local/etc/rc.d/apache22 startEdit the variables in the following files appropriately
# pico /usr/local/etc/smokeping/config
Variable example settings in the first section:
owner = Systems Administrator
contact = sysadmin@domain.com
mailhost = localhost
sendmail = /usr/sbin/sendmail
imgcache = /usr/local/smokeping/htdocs/img
imgurl = /smokeping/img
datadir = /usr/local/var/smokeping
piddir = /usr/local/var/smokeping
cgiurl = http://server.domain.com/smokeping/smokeping.cgi
smokemail = /usr/local/etc/smokeping/smokemail
tmail = /usr/local/etc/smokeping/tmail
*** Alerts ***
to = youraddress@yourdomain.com
from = smokealert@yourdomain.com
The “*** Targets ***” section is where you define your Smokeping targets and build the navigation menu. It is a little too in depth to cover here. Play around with it to figure out how it works.
In depth configuration info is here: http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html
There are some configuration samples here: http://oss.oetiker.ch/smokeping/doc/smokeping_examples.en.html
Verify the path to Speedy:
# pico /usr/local/smokeping/htdocs/smokeping.cgi
-first line pointing to full path of speedy
Customizations to the Smokeping web page templates can be made in the following config files:
/usr/local/etc/smokeping/smokemail
/usr/local/etc/smokeping/basepage.html
/usr/local/etc/smokeping/tmail
Set file system permissions to make the img folder and files writeable:
# find /usr/local/smokeping/htdocs/img -type d -exec chmod 777 {} \;
# find /usr/local/smokeping/htdocs/img -type f -exec chmod 666 {} \;
Allow the startup of Smokeping:
Add the following to /etc/rc.conf
Start Smokeping:
# /usr/local/etc/rc.d/smokeping start
Operational Notes:
index.html at /usr/local/www/apache22/data/
<meta http-equiv=”refresh” content=”0;url=http://www.someotherdomain.com”/>
This redirects traffic sent to the root of your server to a different domain since this traffic obviously doesn’t need to be hitting the Smokeping server.
#/usr/local/etc/rc.d/smokeping restart





This was the final ‘a-ha!’ moment. I then quickly downloaded the