Tiap kali baca artikel dan mengumpulkannya untuk kemudian mempraktekannya, aku selalu terkendala dengan beberapa hal. Selain waktu, sehingga praktek tidak dapat aku lakukan sekaligus saat itu juga sampai selesai; kendala lain adalah hilangnya file sebelum sebuah materi itu aku selesai praktekkan. Tetapi lebih seringnya, sebelum file itu sendiri hilang, aku sudah yakin kalau aku sendiri telah lupa dimana menyimpan file atau link artikel tersebut dalam komputerku. Baca-baca di web dan blog, tiba-tiba muncul ide kenapa aku tidak ikut mengumpulkan artikel aku seperti orang-orang yang menulis ulang dalam blog mereka. Selain membantu penyebaran informasi, tentu saja aku sendiri diuntungkan dengan file yang mudah aku temukan. Kali ini tentang Smokeping on FreeBSD 7 This 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 clean
Installed by default with FreeBSD install
Socket6
# cpan
# install Socket6
# 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:
Add:
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.cgi Allow the startup of Apache:
Add the following to /etc/rc.conf
apache22_enable="YES" # enable Apache 2.2 Start Apache:
# /usr/local/etc/rc.d/apache22 start Edit 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.
# 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
# smokeping_enable=”YES” # enable smokeping
Start Smokeping:
# /usr/local/etc/rc.d/smokeping start
Operational Notes:
- You should now be able to browse to http://www.yourdomain.com/smokeping/ to view your Smokeping statistics.
- You may want to consider securing the Smokeping page with .htaccess users, a firewall or other form of authentication.
- I updated the index.html page in the root of the default Apache site:
index.html at /usr/local/www/apache22/data/
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.
- When you add new targets or change targets in the /usr/local/etc/smokeping/config file you will need to restart Smokeping:
#/usr/local/etc/rc.d/smokeping restart |