Friday, April 19, 2013

Getting a basic Smokeping + Apache installation working in 10 minutes

First, we need to download the source from the vendor's site. By default it will install in /opt/smokeping-<version>, we will follow the defaults:

$ cd /tmp
$ wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
$ tar -xvzf smokeping-2.6.9.tar.gz
$ cd smokeping-2.6.9
$ ./configure ; make ; sudo make install

It is quite possible that during the configure process it will complain about missing dependencies like rrd tool, fping, etc. Follow the instructions and install them until all of them are satisfied.

After it's installation, we will have the folder /opt/smokeping-2.6.9. We create our custom /opt/smokeping-2.6.9/etc/config. Basically it is the default configuration but modifying the last section 'targets' to point to our servers:

$ cat  /opt/smokeping-2.6.9/etc/config

*** General ***
owner    = Andreu
contact  = andreu.antonio@gmail.com
mailhost = smtp.XXXXXXX.com
sendmail = /usr/sbin/sendmail
imgcache = /opt/smokeping-2.6.9/cache
imgurl   = cache
datadir  = /opt/smokeping-2.6.9/data
piddir  = /opt/smokeping-2.6.9/var
cgiurl   = http://some.url/smokeping.cgi
smokemail = /opt/smokeping-2.6.9/etc/smokemail.dist
tmail = /opt/smokeping-2.6.9/etc/tmail.dist
syslogfacility = local0
*** Alerts ***
to =
andreu.antonio@gmail.com
from = andreu.antonio.service@gmail.com
+someloss
type = loss
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times  in a row
*** Database ***
step     = 300
pings    = 20
AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720
*** Presentation ***
template = /opt/smokeping-2.6.9/etc/basepage.html.dist
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d
*** Probes ***
+ FPing
binary = /usr/bin/fping
+ EchoPingSmtp       # SMTP (25/tcp) for mail servers
+ EchoPingHttps      # HTTPS (443/tcp) for web servers
+ EchoPingHttp       # HTTP (80/tcp) for web servers and caches
+ EchoPingIcp        # ICP (3130/udp) for caches
+ EchoPingDNS        # DNS (53/udp or tcp) servers
+ EchoPingLDAP       # LDAP (389/tcp) servers
+ EchoPingWhois      # Whois (43/tcp) servers
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing website.
+ MyServers
menu = APAC
title = APAC
++ Bali
menu = Bali
title = Bali
probe = FPing
host = <my Server IP>
++ Manchester
menu = Manchester
title = Manchester MPLS
probe = FPing
host = <my Server IP>
++ Bangkok
menu = Bangkok
title = Bangkok MPLS
probe = FPing
host = <my Server IP>
++ Bangkok_IPSEC
menu = Bangkok
title = Bangkok IPSEC
probe = FPing
host = <my Server IP>
Now we modify our DNS to make our server has the additional name smokeping-001 (this may vary depending on your DNS solution). Now we go to modify apache config and create the site smokeping-001:

$ sudo vi /etc/apache2/sites-available/smokeping-001
<VirtualHost *:80>
 

        ServerAdmin admin@mydomain.com
        ServerName smokeping-001.mydomain.singapore
        DocumentRoot /opt/smokeping-2.6.9/htdocs

        <Directory />
                Options FollowSymLinks +ExecCGI
                AllowOverride None
        </Directory>
 

        ErrorLog ${APACHE_LOG_DIR}/smokeping-error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/smokeping-access.log combined

</VirtualHost>

We enable the site and also the Fast CGI mod. We might need to download this mod if it is not in our system (use apt / yum util).

$ sudo a2ensite smokeping-001
$ sudo a2enmod mod_fcgid
Smokeping installation will have placed the smokeping daemon. To start it, we need to execute:

$ sudo /etc/init.d/smokeping start

Wait for a few minutes, smokeping should be catching data by now.

No comments:

Post a Comment