Wednesday, December 3, 2014

Monitor network latency with smokeping

1- Download smokeping and install
root@network-monitor:/# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
root@network-monitor:/# tar xvf smokeping-2.6.11.tar.gz
root@network-monitor:/# cd smokeping-2.6.11
root@network-monitor:/# setup/build-perl-modules.sh
root@network-monitor:/# ./configure
root@network-monitor:/# make
root@network-monitor:/#  make install

after complete the step the smokeping will be installed in /opt/smokeping-2.6.11


2- install factcgi and configure it to host smokeping
root@network-monitor:/# apt-get install libapache2-mod-fastcgi
- create a file name smokeping.conf in /etc/apache2/conf-enabled/ with the following content

ScriptAlias /smokeping/smokeping.fcgi /opt/smokeping-2.6.11/htdocs/smokeping.fcgi.dist
Alias /smokeping /opt/smokeping-2.6.11/htdocs
<Directory /opt/smokeping-2.6.11/htdocs>
 Options FollowSymLinks
 AllowOverride all
 Order Deny,Allow
 Allow  from all
 Require all granted
</Directory>



then save and restart apache2
root@network-monitor:/#  service apacehe2 restart


3- create necessary file/directory and assign permission
root@network-monitor:/# apt-get install fping
root@network-monitor:/# cd /opt/smokeping-2.6.11/
root@network-monitor:/# mkdir data
root@network-monitor:/# mkdir var
root@network-monitor:/# mkdir htdocs/cache/Test -p
root@network-monitor:/# chmod 777 -R data
root@network-monitor:/# chmod 777 -R htdocs

4- configure smokeping and add host localhost and google_dns to monitor their latency
 create a file name config in /opt/smokeping-2.6.11//etc/ with the following content

*** General ***
owner    = Peter Random
contact  = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
imgcache = /opt/smokeping-2.6.11/htdocs/cache
imgurl   = cache
datadir  = /opt/smokeping-2.6.11/data
piddir  = /opt/smokeping-2.6.11/var
cgiurl   = http://localhost/smokeping/smokeping.fcgi
smokemail = /opt/smokeping-2.6.11/etc/smokemail.dist
tmail = /opt/smokeping-2.6.11/etc/tmail.dist
syslogfacility = local0
*** Alerts ***
to = alertee@address.somewhere
from = smokealert@company.xy
+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.11/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
*** Slaves ***
secrets=/opt/smokeping-2.6.11/etc/smokeping_secrets.dist
+boomer
display_name=boomer
color=0000ff
+slave2
display_name=another
color=00ff00
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. \
         Here you will learn all about the latency of our network.
+ Test
menu= Targets
++ Localhost
menu = Localhost
title =Localhost
alerts = someloss
slaves = boomer slave2
host = localhost
++ Google_DNS
menu = Google_DNS
title = Google_DNS
alerts = someloss
host = 8.8.4.4




then start the smoking

 root@network-monitor:/# /opt/smokeping-2.6.11/bin/smokeping

or after update anything on config file we can restart smokeping with argv --restart 
 root@network-monitor:/# /opt/smokeping-2.6.11/bin/smokeping --restart


5- access the statistic using the following url, http://localhost/smokeping/smokeping.fcgi   , you can change localhost to ip address of web server



No comments:

Post a Comment