Tuesday, November 26, 2013

How to install and configure smokeping on CentOS 6 or CentOS 5?

Smokeping is a very useful network monitoring tool but it’s also very complicated to install and configure.
Here are the steps for installing smokeping on CentOS 6 or CentOS 5.
To make it easier to deploy we recommend to temporarily disable selinux with this command:
setenforce 0

1 – Install rpmforge
# yum install wget
* For CentOS 6 please use this repository:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
* For CentOS 5 please use this repository:
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

2 – Install required packages
# yum install mod_fcgid httpd httpd-devel rrdtool fping wget curl bind-utils gcc make

3 – Install more packages
# yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-RRD-Simple perl-CGI-SpeedCGI perl-ExtUtils-MakeMaker

4 – Install smokeping
# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
* You should check on smokeping website for the latest version.
# tar -zxvf smokeping-2.6.8.tar.gz -C /opt/
# mkdir /opt/smokeping
# cd /opt/smokeping-2.6.8/setup
# ./build-perl-modules.sh
# cp -r ../thirdparty /opt/smokeping/
# cd ..
# ./configure –prefix=/opt/smokeping
* There are twice – before the prefix so it is –prefix. # make install

5 – Create missing folders
# cd /opt/smokeping
# mkdir data var cache

6 – Add smokeping start/stop script
# wget http://new.wedebugyou.com/static/smokeping_start_stop.txt
# mv smokeping_start_stop.txt /etc/init.d/smokeping
# chmod 755 /etc/init.d/smokeping

Here are the steps for configuring smokeping.

1 – Rename config files and change security
# cd /opt/smokeping/etc/
# for foo in *.dist; do cp $foo `basename $foo .dist`; done
# chmod 600 /opt/smokeping/etc/smokeping_secrets.dist

2 – Change the default config files
# vi config
Change the values in bold to something that fit your needs.
owner    = Peter Random
contact  = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed … this is not
# good for images.
imgcache = /opt/smokeping/cache
imgurl   = cache
datadir  = /opt/smokeping/data
piddir  = /opt/smokeping/var
cgiurl   = http://some.url/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail.dist
tmail = /opt/smokeping/etc/tmail.dist

Here is an example:
owner    = Jean Debogue
contact  = noc@jeandebogue.com
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed … this is not
# good for images.
imgcache = /opt/smokeping/cache
imgurl   = cache
datadir  = /opt/smokeping/data
piddir  = /opt/smokeping/var
cgiurl   = http://graph.mydomain.com/smokeping/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail.dist
tmail = /opt/smokeping/etc/tmail.dist

3 – Configure smokeping into the webserver
# cd /opt/smokeping
# ln -s /opt/smokeping/cache /opt/smokeping/htdocs/cache
# chown -R apache cache
# chown -R apache data
Add these lines into the file /etc/httpd/conf.d/smokeping.conf
ScriptAlias /smokeping/smokeping.cgi /opt/smokeping/htdocs/smokeping.fcgi.dist
Alias /smokeping /opt/smokeping/htdocs
<Directory “/opt/smokeping/htdocs”>
Options FollowSymLinks
</Directory>

4 – Start smokeping
# /etc/init.d/smokeping start
# /etc/init.d/httpd start

 5 – Expect the worst hope for the best
If there are no error message you are in a very good position. You can now browse to the webpage you configure in the config file cgiurl = http://graph.mydomain.com/smokeping/smokeping.cgi.
1 – Add your own host in the config file
It’s quite complicated to explain all the details of smokeping configuration file. The best is to read their documentation or check the many examples available online. You can also use our example config file. Just paste this file under the line *** Probes *** in your config file. Our example contains an icmp probe, a dns check, a check on port 80 and a full fetch of the default webpage of www.google.com.

2 – Restart smokeping
After changing the config file, it is important to restart smokeping with this command:
# /etc/init.d/smokeping restart

3 – Clean installation files
# rm -rf /opt/smokeping-2.6.8

4 – Enable smokeping to start automatically on reboot
# chkconfig –add smokeping
* There are twice – before the add so it is –add.
# chkconfig httpd on
# chkconfig smokeping on
smokeping graph
You can now also use smokeping. Do you also use smokeping? Do you monitor routers, servers, websites? Do you use it into a master/slave mode? We would like to hear from you how you use smokeping in your day to day life.

Source :  http://www.wedebugyou.com/2012/11/how-to-install-and-configure-smokeping-on-centos-6/

No comments:

Post a Comment