Call us Today +49 7543 609337-0
Log In

This HowTo describes the steps necessary to install Smokeping 2.6.11 on a Centos 32bit system with SELinux enabled.

Install Pre-requirements

Smokeping requires some perl modules to be installed. Although it is downloading necessary modules during the installation, it is always a good idea to use pre-built packages for easier upgrade possibilites

rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpm -Uvh http://ftp.uni-koeln.de/mirrors/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
yum --assumeyes install rrdtool-perl perl-FCGI perl-CGI perl-libwww-perl perl-ExtUtils-MakeMaker setools echoping \
  fping curl perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL \
  perl-Socket6 perl-CGI-SpeedyCGI perl-Sys-Syslog gcc httpd zip unzip

Download and install Smokeping

Now let’s download and install the current smokeping version.

cd /tmp
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
tar -xzvf smokeping-2.6.11.tar.gz
cd smokeping-2.6.11
./setup/build-perl-modules.sh /opt/smokeping-2.6.11/thirdparty 
./configure --prefix=/opt/smokeping-2.6.11
/usr/bin/gmake install

Do some pre-configuration tasks

Smokeping comes with some default configurations and templates so let’s use them as a basis for our smokeping installation

chmod 4775 /bin/traceroute
cd /opt/smokeping-2.6.11/bin/
cp smokeping.dist smokeping
cd /opt/smokeping-2.6.11/htdocs/
cp smokeping.fcgi.dist smokeping.fcgi
cd /opt/smokeping-2.6.11/etc/
cp config.dist config
cp basepage.html.dist basepage.html
cp smokemail.dist smokemail
cp tmail.dist tmail
cp smokeping_secrets.dist smokeping_secrets
chmod 600 /opt/smokeping-2.6.11/etc/smokeping_secrets

Create required directories

We need to create some cache and data directories for smokeping to store it’s rrd files and temporary images.

mkdir -p /var/www/html/smokeping/img
mkdir -p /var/www/html/smokeping/script
mkdir -p /opt/smokeping-2.6.11/data
mkdir -p /opt/smokeping-2.6.11/var
chown -R apache:apache /var/www/html/smokeping/img

Set some symlinks and copy the cgi files

The following code creates a symlink to /opt/smokeping for the current smokeping version. This allows for a smoother update of smokeping without the need to change configuration files or other required symlinks for each update of smokeping

ln -s /opt/smokeping-2.6.11 /opt/smokeping
ln -s /opt/smokeping/htdocs/cropper /var/www/html/smokeping/cropper 
ln -s /opt/smokeping/htdocs/resource /var/www/html/smokeping/resource 
cp /opt/smokeping/htdocs/smokeping.fcgi /var/www/cgi-bin/smokeping.fcgi

[field name=AdsWithin]

Change/fix some default configuration entries

As we are using the default configuration of the smokeping package, we have to change some settings to match our installtion. The followin sed commands replace the template version with our actual directory and file names

sed -i 's#/opt/smokeping-2.6.11/cache#/var/www/html/smokeping/img#' /opt/smokeping/etc/config
sed -i 's#imgurl.*=.*cache#imgurl = /smokeping/img#' /opt/smokeping/etc/config
sed -i 's#mailhost.*=.*my.mail.host#mailhost = '`hostname`'#g' /opt/smokeping/etc/config
sed -i 's#to.*=.*alertee@address.somewhere#to = '`whoami`@`hostname`'#g' /opt/smokeping/etc/config
sed -i 's#from.*=.*smokealert@company.xy#from = smokeping@'`hostname`'#g' /opt/smokeping/etc/config
sed -i 's#template.*=.*/opt/smokeping-2.6.11/etc/basepage.html.dist#template = /opt/smokeping/etc/basepage.html#g' /opt/smokeping/etc/config
sed -i 's#secrets=/opt/smokeping-2.6.11/etc/smokeping_secrets.dist#secrets=/opt/smokeping/etc/smokeping_secrets#g' /opt/smokeping/etc/config
sed -i 's#remark = Welcome to the SmokePing website of xxx Company. \\#remark = Welcome to the SmokePing.\\#g' /opt/smokeping/etc/config
sed -i 's#owner = Peter Random#owner = '`whoami`'#g' /opt/smokeping/etc/config
sed -i 's#contact = some@address.nowhere#contact = '`whoami`@`hostname`'#g' /opt/smokeping/etc/config

sed -i 's#cropper/#/smokeping/cropper/#' /opt/smokeping/etc/basepage.html

Configure some default targets

Now let’s start with some default devices to be monitored. We’re therefore replacing the default entries coming with smokeping to actually point to localhost. Ping times will be great  for this device but it also will show us that our smokeping installation succeeded

# Configure targets

sed -i 's#+ Test#+ Targets#g' /opt/smokeping/etc/config

sed -i 's#++ James#++ Localhost#g' /opt/smokeping/etc/config
sed -i 's#menu = James#menu = Localhost#g' /opt/smokeping/etc/config
sed -i 's#title =James#title = Localhost#g' /opt/smokeping/etc/config
sed -i 's/slaves = boomer slave2/#slaves = boomer slave2/g' /opt/smokeping/etc/config
sed -i 's#host = james.address#host = 127.0.0.1#g' /opt/smokeping/etc/config

sed -i 's/++ MultiHost/#++ MultiHost/g' /opt/smokeping/etc/config
sed -i 's/menu = Multihost/#menu = Multihost/g' /opt/smokeping/etc/config
sed -i 's/title = James and James as seen from Boomer/#title = James and James as seen from Boomer/g' /opt/smokeping/etc/config
sed -i 's|host = /Test/James /Test/James~boomer|#host = /Test/James /Test/James~boomer|g' /opt/smokeping/etc/config

Restart Apache and make it autostart after a reboot

Let’s restart Apache so all modules and configuration changes that have occured are read in. We’re also enabling Apache to the start automatically after a system reboot.

/etc/init.d/httpd restart
chkconfig httpd on

Add some firewall rules for http and https

In case you want to look at the smokeping pages from other systems than localhost, we will have to add some firewall rules to enable http and https traffic from outside

iptables -I INPUT 1 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 1 -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

Install/Enable the selinux policy for smokeping

You can download the SELinux policy  for smokeping from here  or follow the below steps to install it

wget http://blog.network-outsourcing.de/wp-content/uploads/smokeping_selinux.zip
unzip smokeping_selinux.zip
semodule -i smokeping.pp

Add smokeping to automatic startup

[newsletter_lock]By default smokeping does not automatically start after a system restart so we will have to add a startup script for it

cd /tmp
wget http://blog.network-outsourcing.de/wp-content/uploads/smokeping_init_script.zip
unzip smokeping_init_script.zip
cp smokeping /etc/init.d/
chmod +x /etc/init.d/smokeping
/etc/init.d/smokeping start

[/newsletter_lock]