Memonitoring ping ke beberapa situs merupakan pekerjaan yang butuh banyak waktu, dari segi kebutuhan dan history mungkin kita susah untuk menyimpan datanya. Untuk itulah kita perlu menggunakan smokeping, smokeping adalah software yang digunakan untuk merekam ping ke satu atau beberapa situs sekaligus.

Install dependency Smokeping di Debian

Dependency ini dibutuhkan agar smokeping bisa di compile di Debian 9

apt install gcc make libwww-perl libcgi-fast-perl libtext-soundex-perl libio-pty-perl libcrypt-ssleay-perl rrdtool librrds-perl libssl-dev -y

Download Smokeping

Download smokeping versi terbaru dari Download Latest smokeping version. Dari command line bisa kita gunakan

wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.7.3.tar.gz

Ekstrak file yang baru di download

tar zxvf smokeping-2.7.3.tar.gz

Compile dan Install Smokeping

Compile dan install smokeping dari source. Pastikan anda tidak lupa menjalankan export LC_ALL=C, agar smokeping tidak komplain sewaktu di install.

cd smokeping-2.7.3
export LC_ALL=C
./configure --prefix=/usr/local/smokeping
make install

Konfigurasi Smokeping 2.7

Buat folder untuk menyimpan cache dan data smokeping

mkdir /usr/local/smokeping/cache
mkdir /usr/local/smokeping/data
mkdir /usr/local/smokeping/var

Buat file baru /usr/local/smokeping/etc/config yang berisi

*** General ***
owner    = Jaranguda
contact  = some@address.nowhere
mailhost = my.mail.host
imgcache = /usr/local/smokeping/cache
imgurl   = cache
datadir  = /usr/local/smokeping/data
piddir  = /usr/local/smokeping/var
cgiurl   = http://some.url/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/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 = /usr/local/smokeping/etc/basepage.html.dist
htmltitle = yes
graphborders = no
+ 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/local/sbin/fping
*** Slaves ***
secrets=/usr/local/smokeping/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 jaranguda.com Company.
 
+ DNS
menu = DNS
title = DNS Server
 
++ OpenDNS
menu = OpenDNS
title = OpenDNS
host = 208.67.222.222
 
++ Google
menu = GoogleDNS
title = GoogleDNS
host = 8.8.4.4
 
++ Cloudflare-DNS
menu = Cloudflare-DNS
title = Cloudflare-DNS
host = 1.1.1.1

Ubah file permission configurasi smokeping

chmod 600 /usr/local/smokeping/etc/*

Install FPING

Karena versi FPING yang ada di repository Debian 9, tidak compatibel dengan smokeping 2.7.3 maka kita akan mencompile fping 2.4 dari source.

wget http://www.fping.org/dist/fping-4.2.tar.gz
tar zxvf fping-4.2.tar.gz
cd fping-4.2
./configure; make; make install

Jalankan Smokeping 2.7.3

/usr/local/smokeping/bin/smokeping --config=/usr/local/smokeping/etc/config
# untuk mengaktifkan debug jalankan
/usr/local/smokeping/bin/smokeping --config=/usr/local/smokeping/etc/config --debug

Konfigurasi Untuk Apache 2.4

Install apache 2.4 di Debian 9

apt install apache2 libapache2-mod-fcgid -y

Buat file konfigurasi smokeping di /etc/apache2/conf-enabled/smokeping.conf yang isinya

Alias /smokeping/cache /usr/local/smokeping/cache
Alias /smokeping /usr/local/smokeping/htdocs/
 
 
<Directory "/usr/local/smokeping/cache">
  AllowOverride all
  Require all granted
</Directory>
 
<Directory "/usr/local/smokeping/htdocs/">
 Options FollowSymLinks ExecCGI
 AllowOverride all
 Require all granted
</Directory>

Aktifkan cgi di apache

a2enmod cgi
# lalu restart apache
systemctl restart apache2

Karena disini smokeping dijalankan oleh user www-data (apache2), ubah permission folder /usr/local/smokeping// agar bisa dibaca tulis oleh apache

chown www-data:www-data -R /usr/local/smokeping/

Buka web ui smokeping dari http://IPSERVER/smokeping/smokeping.fcgi.dist
smokeping 2.7.3 terinstall

Setelah kurang lebih 5 menit, data di grafik mulai muncul
grafik smokeping debian 9

Join the Conversation

4 Comments

Your email address will not be published. Required fields are marked *

  1. konfigurasi alert yang bener gimana ya pak, dari patern berikut. cuma 1 pattern yang ngirim notifikasi.yaitu someloss. ada satu IP inactive yang di pasang buat ngetes kalo ngedetect hostnamenya down tapi yang ngirim tetep pattern someloss.

    +bigloss
    type = loss
    # in percent
    pattern = ==0%,==0%,==0%,==0%,>0%,>0%,>0%
    comment = suddenly there is packet loss

    +someloss
    type = loss
    # in percent
    pattern = >0%,*12*,>0%,*12*,>0%
    comment = detected loss 3 times over the last two hours

    +startloss
    type = loss
    # in percent
    pattern = ==S,>0%,>0%,>0%
    comment = loss at startup

    +rttdetect
    type = rtt
    # in milli seconds
    pattern = <10,<10,<10,<10,<10,100,>100,>100
    comment = routing messed up again ?

    +hostdown
    type = loss
    # in percent
    pattern = ==U
    comment = no reply

    lognya:
    Alert: someloss, Target: pc.test, Loss Pattern: 100%, RTT: rtt: S, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, Hostname: 192.168.1.2

  2. artikelnya sangat bermanfaat pak. untuk konfigurasi master slave gimana ya pak. dari slave kirim data dah OK. cuma di master gak muncul. tadi di file rrd untuk slave nya udah ke create. pencerahannya pak