CentOS7 に Smokeping をインストールする

以前に Docker で Smokeping を起動するというメモを書きました。 今回は Docker を使わず、CentOS7 上に直接、Smokeping をインストールする手順をメモしておきます。

インストール

epel からインストール可能です。

# yum info smokeping
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * remi-safe: mirrors.tuna.tsinghua.edu.cn
 * updates: www.ftp.ne.jp
Available Packages
Name        : smokeping
Arch        : noarch
Version     : 2.6.10
Release     : 3.el7
Size        : 507 k
Repo        : epel/x86_64
Summary     : Latency Logging and Graphing System
URL         : http://oss.oetiker.ch/smokeping/
License     : GPLv2+
Description : SmokePing is a latency logging and graphing system. It consists of a
            : daemon process which organizes the latency measurements and a CGI
            : which presents the graphs.

yum でインストールします。 フロントエンドになる Web サーバ (Apache) もインストールしておきます。

yum -y install httpd smokeping

Smokeping と Apache を起動します。 自動起動設定もしておきます。

systemctl enable smokeping.service
systemctl start smokeping.service
systemctl enable httpd.service
systemctl start httpd.service

設定ファイルのカスタマイズ

Probes 定義部分を見ると、Smokeping は初期設定で ICMP (Ping) 監視に fping を利用していることが分かります。 HTTP 監視用に /usr/bin/curl を追加します。 設定変更後の設定ファイル (/etc/smokeping/config) 例は以下の通りです。

*** General ***

owner    = Super User
contact  = root@localhost
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 = /var/lib/smokeping/images
imgurl   = /smokeping/images
datadir  = /var/lib/smokeping/rrd
piddir   = /var/run/smokeping
cgiurl   = http://localhost/smokeping/sm.cgi
smokemail = /etc/smokeping/smokemail
tmail     = /etc/smokeping/tmail
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no

*** Alerts ***
to = root@localhost
from = root@localhost

+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times  in a row

*** Database ***

#step     = 300
step     = 60
pings    = 20

# consfn mrhb steps total

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 = /etc/smokeping/basepage.html

+ 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

#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location

*** Probes ***

+ FPing

binary = /usr/sbin/fping

+ Curl

binary = /usr/bin/curl
step = 60
urlformat = http://%host%/

*** Slaves ***
secrets=/etc/smokeping/smokeping_secrets
+boomer
display_name=boomer
color=0000ff

+slave2
display_name=another
color=00ff00

*** Targets ***

#menuextra = <a target='_blank' href='/smokeping/tr.html{HOST}' class='{CLASS}' \
#               onclick="window.open(this.href,this.target, \
#               'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no'); \
#                return false;">*</a>
#
probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \
         Here you will learn all about the latency of our network.

+ ICMP

menu = ICMP
title = ICMP

++ Google_DNS-1

menu = Google DNS-1
title = Google DNS-1 (8.8.8.8)
host = 8.8.8.8

++ Google_DNS-2

menu = Google DNS-2
title = Google DNS-1 (8.8.4.4)
host = 8.8.4.4

+ HTTP

probe = Curl
menu = HTTP
title = HTTP

++ Google

menu = Google
title = www.google.co.jp
host = www.google.co.jp

++ Yahoo

menu = Yahoo
title = www.yahoo.co.jp
host = www.yahoo.co.jp

設定ファイルを変更したら Smokeping と Apache を再起動し、変更を反映します。

systemctl restart smokeping.service
systemctl restart httpd.service

初期状態の /etc/smokeping/config

*** General ***

owner    = Super User
contact  = root@localhost
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 = /var/lib/smokeping/images
imgurl   = /smokeping/images
datadir  = /var/lib/smokeping/rrd
piddir   = /var/run/smokeping
cgiurl   = http://localhost/smokeping/sm.cgi
smokemail = /etc/smokeping/smokemail
tmail     = /etc/smokeping/tmail
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no

*** Alerts ***
to = root@localhost
from = root@localhost

+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times  in a row

*** Database ***

step     = 300
pings    = 20

# consfn mrhb steps total

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 = /etc/smokeping/basepage.html

+ 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

#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location

*** Probes ***

+ FPing

binary = /usr/sbin/fping

*** Slaves ***
secrets=/etc/smokeping/smokeping_secrets
+boomer
display_name=boomer
color=0000ff

+slave2
display_name=another
color=00ff00

*** Targets ***

#menuextra = <a target='_blank' href='/smokeping/tr.html{HOST}' class='{CLASS}' \
#               onclick="window.open(this.href,this.target, \
#               'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no'); \
#                return false;">*</a>
#
probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \
         Here you will learn all about the latency of our network.

+ Ping

menu = Fedora
title = Fedora Pings

++ FedoraprojectOrg

menu = fedoraproject.org
title = Fedora Webserver
host = fedoraproject.org

++ DocsFedoraprojectOrg

menu = docs.fedoraproject.org
title = Fedora Docs Webserver
host = docs.fedoraproject.org

++ PlanetFedora

menu = planet.fedoraproject.org
title = Planet Fedora
host = planet.fedoraproject.org

#
# Lots of more options are available, please have a look in the included documentation.
#

#++ James

#menu = James
#title =James
#alerts = someloss
#slaves = boomer slave2
#host = james.address

#++ MultiHost

#menu = Multihost
#title = James and James as seen from Boomer
#host = /Test/James /Test/James~boomer

参考

コメント

タイトルとURLをコピーしました