Ipv6smokeping
Download
Report
Transcript Ipv6smokeping
IPv6 DNS主機
Smokeping
監測
電算中心呂芳發
2011年11月12日
1
大綱
Smokeping 簡介
Smokeping 安裝
Config 設定檔說明
結論
©2011 Computer Center, National Central University.
2
SmokePing簡介
SmokePing 用來從外部檢測服務系統的
latency ,用 Perl 可以快速自製檢測工具,並
自動存成 RRDTool DB 與圖檔,內建的
Alert 支援 Real-Time Traffic Pattern
Detection,可以非常有彈性的用以自定警報通
知。
©2011 Computer Center, National Central University.
3
SmokePing特性
跟蹤網絡延遲(latency)。
延遲(latency)視覺化管理工具。
圖形資源管理。
可彈性加入延遲測量工具。
可配置警報系統。
“有趣”的圖形延遲圖表。
免費軟體
©2011 Computer Center, National Central University.
4
如何看 Smokeping 圖
藉著發送測試數據封包量測往返時間。
對於每一cycle測量 smokeping發送多個數據封
包。 在各種不同的往返時間,選擇中位數(即
中間的一個)。 即當有10時間值,選擇第5個
時間值繪製, 其他值繪製成連續的灰色色調的
背景。
Data packets loss , 以不同顏色表示掉封包比
率。
©2011 Computer Center, National Central University.
5
如何看 Smokeping 圖-簡圖
AV MD
平均中位數
AV LS
平均損失
AV SD
在每一輪的多次測量
的平均標準偏差
AM / AS
平均中位數和平均標
準差的比率
©2011 Computer Center, National Central University.
6
如何看 Smokeping 圖-詳細圖
AVG,MAX,MIN
,now
平均,最高,最低
,目前的中位數
SD
標準差中位數
am/ S
平均中位數與標準
差的比率
©2011 Computer Center, National Central University.
7
Smokeping install
Smokeping是用perl所寫的程序,不需要安裝
。
用perl所寫,需要使用到一些工具像是rrdtool
、fping、libwww-perl等,以及perl的module
。需要先安裝好,當Smokeping 服務啟動時會
自動簡查所需要的程序是否都安裝完成。
©2011 Computer Center, National Central University.
8
Smokeping install
using CentOS 5.7
# yum update
# rpm -Uhv
http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmfor
ge-release-0.3.6-1.el5.rf.i386.rpm
# yum install httpd
# yum install rrdtool
# yum install fping
# yum install echoping
# yum install curl
# yum install perl perl-Net-Telnet perl-Net-DNS perl-libwwwperl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI
©2011 Computer Center, National Central University.
9
Smokeping install
Use the FPing6 probe
Download fping6 :
wget http://unfix.org/projects/ipv6/fping-2.4b2_toipv6.tar.gz
tar xvzf fping-2.4b2_to-ipv6.tar.gz
cd fping-2.4b2_to-ipv6
configure
make
make install
©2011 Computer Center, National Central University.
10
Smokeping install
# wget
http://oss.oetiker.ch/smokeping/pub/smokeping2.4.1.tar.gz
# tar zxvf smokeping-2.4.1.tar.gz
# mv smokeping-2.4.1 /opt/smokeping
# cd /opt/smokeping
# cd bin/
# cp smokeping.dist smokeping
# cd ../htdocs/
# cp smokeping.cgi.dist smokeping.cgi
©2011 Computer Center, National Central University.
11
Smokeping install
# cp tr.cgi.dist tr.cgi
# cd ../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/etc/smokeping_secrets
©2011 Computer Center, National Central University.
12
Smokeping install
# vi /opt/smokeping/bin/smokeping
Replace this:
With This:
1
2
3
4
5
6
7
8
9
#!/usr/sepp/bin/perl-5.8.4 -w
# -*-perl-*-
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl -w
# -*-perl-*-
use lib qw(/usr/pack/rrdtool-1.2.23-mo/lib/perl);
use lib qw(lib);
use Smokeping 2.004000;
Smokeping::main("etc/config.dist");
use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-threadmulti/auto/RRDs/);
use lib qw(/opt/smokeping/lib);
use Smokeping 2.004000;
Smokeping::main("/opt/smokeping/etc/config");
©2011 Computer Center, National Central University.
13
Smokeping install
# vi /opt/smokeping/htdocs/smokeping.cgi
Replace this:
#!/usr/sepp/bin/speedy -w
1 # -*-perl-*2
3 use lib qw(/usr/pack/rrdtool-1.0.334 to/lib/perl);
5 use lib
6 qw(/home/oetiker/data/projects/AADJ7 smokeping/dist/lib);
8 use CGI::Carp qw(fatalsToBrowser);
9
10 use Smokeping 2.004000;
Smokeping::cgi("/home/oetiker/data/project
s/AADJ-smokeping/dist/etc/config");
©2011 Computer Center, National Central University.
14
Smokeping install
With this:
#!/usr/bin/speedy -w
1 # -*-perl-*2
3 use lib
4 qw(/usr/lib/perl5/vendor_perl/5.8.8/i386-linux5 thread-multi/auto/RRDs);
6 use lib qw(/opt/smokeping/lib);
7 use CGI::Carp qw(fatalsToBrowser);
8
9 use Smokeping 2.004000;
10
Smokeping::cgi("/opt/smokeping/etc/config");
©2011 Computer Center, National Central University.
15
Smokeping install
# cd /opt/smokeping/htdocs
# vi /opt/smokeping/htdocs/tr.cgi
Replace this:
1
2
3
4
#!/usr/sepp/bin/speedy-5.8.8 -w
use strict;
use lib
qw(/home/oposs/smokeping/software/lib);
use lib qw(perl);
©2011 Computer Center, National Central University.
16
Smokeping install
With this:
1
2
3
4
#!/usr/bin/speedy -w
use strict;
use lib qw(/opt/smokeping/lib);
use lib qw(perl);
©2011 Computer Center, National Central University.
17
Smokeping install
# mkdir -p /var/www/html/smokeping/img
/var/www/html/smokeping/script/ /opt/smokeping/data
/opt/smokeping/var
# chown -R apache:apache /var/www/html/smokeping/img
# ln -s /opt/smokeping/htdocs/cropper
/var/www/html/smokeping/cropper
# ln -s /opt/smokeping/htdocs/resource
/var/www/html/smokeping/resource
# ln -s /opt/smokeping/htdocs/script/Tr.js
/var/www/html/smokeping/script/Tr.js
# ln -s /opt/smokeping/htdocs/smokeping.cgi
/var/www/html/smokeping/smokeping.cgi
# ln -s /opt/smokeping/htdocs/tr.cgi
/var/www/html/smokeping/tr.cgi
©2011 Computer Center, National Central University.
18
Smokeping install
vi /etc/httpd/conf/httpd.conf
change > #AddHandler cgi-script .cgi
to > AddHandler cgi-script .cgi
Under <Directory “/var/www/html”>
change > Options Indexes FollowSymLinks
to > Options Indexes FollowSymLinks ExecCGI
AddDefaultCharset UTF-8
©2011 Computer Center, National Central University.
19
Smokeping install
# vi /opt/smokeping/etc/basepage.html
Change this:
1
2
3
4
To this:
1
2
3
4
<script src="cropper/lib/prototype.js"
type="text/javascript"></script>
<script src="cropper/lib/scriptaculous.js?load=builder,dragdrop"
type="text/javascript"></script>
<script src="cropper/cropper.js"
type="text/javascript"></script>
<script src="cropper/smokeping-zoom.js"
type="text/javascript"></script>
<script src="/smokeping/cropper/lib/prototype.js"
type="text/javascript"></script>
<script
src="/smokeping/cropper/lib/scriptaculous.js?load=builder,dragdrop
" type="text/javascript"></script>
<script src="/smokeping/cropper/cropper.js"
type="text/javascript"></script>
<script src="/smokeping/cropper/smokeping-zoom.js"
type="text/javascript"></script>
©2011 Computer Center, National Central University.
20
Smokeping install
# vi /opt/smokeping/htdocs/tr.html
Change this:
To this:
1
2
3
4
5
6
7
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>SmokeTrace</title>
<script type="text/javascript"
src="script/Tr.js"></script>
</head>
</html>
1
2
3
4
5
6
7
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>SmokeTrace</title>
<script type="text/javascript"
src="/script/Tr.js"></script>
</head>
</html
©2011 Computer Center, National Central University.
21
Smokeping install
# ln -s /opt/smokeping/htdocs/tr.html
/var/www/html/smokeping/tr.html
# vi /opt/smokeping/etc/config
©2011 Computer Center, National Central University.
22
Smokeping install
# vi /etc/init.d/smokeping
# chmod 755 /etc/init.d/smokeping
Apache and Smokeping startup
#
#
#
#
/sbin/chkconfig smokeping on
/sbin/chkconfig httpd on
/sbin/service smokeping start
/sbin/service httpd start
©2011 Computer Center, National Central University.
23
Smokeping install
browse http://140.115.2.38/smokeping/smokeping.cgi
©2011 Computer Center, National Central University.
24
Smokeping config
©2011 Computer Center, National Central University.
25
Config
*** General ***
owner
= ncuadmin
contact = [email protected]
mailhost = 140.115.2.38
sendmail = /usr/sbin/sendmail
imgcache = /var/www/html/smokeping/img
imgurl = http://140.115.2.38/smokeping/img
datadir = /opt/smokeping/data
piddir = /opt/smokeping/var
cgiurl = http://140.115.2.38/smokeping/smokeping.cgi
©2011 Computer Center, National Central University.
26
Config
*** Alerts ***
to = [email protected] (設定要收到警報信件的信箱)
from = [email protected] (設定本機發信的帳號 )
+someloss
type = loss
# in percent
pattern = >20%,>20%
comment =
#說明 : 當連續兩個週期封包都Loss高於20% 時就alert
*** Database ***
step
= 300
#300秒
pings
= 20
#ping 20次
©2011 Computer Center, National Central University.
27
Config
*** Presentation ***
template = /opt/smokeping/etc/basepage.html
charset = UTF-8
+ 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
©2011 Computer Center, National Central University.
28
Config
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping6
+ DNS
binary = /usr/bin/dig
pings = 5
step = 180
©2011 Computer Center, National Central University.
29
Config
*** Targets ***
+ DNS
probe = FPing
probe = DNS
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing
website.
+ network
menu = DNS latency
title = Service latency (DNS)
++ dns1
host = 2001:288:3001:1::31
++ dns2
menu = Net latency
title = Network latency (ICMP pings)
host = 2001:288:3000:227::4
++ ns1
host = 2001:288:3001:1::31
++ ns2
host = 2001:288:3000:227::4
©2011 Computer Center, National Central University.
30
Config
©2011 Computer Center, National Central University.
31
Config
©2011 Computer Center, National Central University.
32
Config-curl
*** Probes ***
+ Curl
binary = /usr/bin/curl
step = 60
# a default for this target-specific variable
urlformat = http://%host%/
*** Targets ***
probe = Curl
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing website.
+ HTTP
menu = http
title = HTTP latency
++ ncuweb
menu = ncuweb
title = HTTP latency for ncuweb
host = www.ncu.edu.tw
©2011 Computer Center, National Central University.
33
Config-curl
©2011 Computer Center, National Central University.
34
Config-echoping
*** Probes ***
+ EchoPingHttp
binary = /usr/bin/echoping
*** Targets ***
probe = EchoPingHttp
menu = Top
title = Network Latency Grapher
remark = Welcome to this SmokePing website.
+ HTTP
menu = http
title = HTTP latency
++ ncuweb
menu = ncuweb
title = HTTP latency for ncuweb
host = www.ncu.edu.tw
©2011 Computer Center, National Central University.
35
Config-echoping
©2011 Computer Center, National Central University.
36
結論
好用的延遲(latency)狀態量測工具
除了監測封包量測往返時間, 搭配其他工具可
監測web,ftp 下載的時間及dns查詢時間
©2011 Computer Center, National Central University.
37
Thank You!
©2011 Computer Center, National Central University.
38