如何的使用smokeping来监控idc机房的网络质量情况,从监控图上的延时与丢包能分辨出你机房的网络是否稳定,是否为多线,是否为BGP机房,到各城市的3个运行商网络各是什么情况,如果出现问题,如果有针对的解决。而且如果选择新机房的时候,你可以根据smokeping的监控结果来判断这个机房是否适合。
图表参数说明
(1) RTT(Round-Trip Time):简单说它是一个数据报在网络上两点中间往返一次的时间。是影响TCP性能和表征网络运行状况的重要参数。在网络中实时、准确地测量大量TCP设备和系统的RTT参数是网络管的重要环节之一。Smokeping就是这样的自动测试系统,它向目标设备和系统发送各种类型的测试数据包,测量、记录和展示RTT。
(2) Median RTT:它是中间数并不是平均值。Smokeping有多种类型的探针,探针在默认的设置下,每300秒向目标设备发送20测探测数据包。假如这20个数据包都返回的话,它就记录下了20个RTT,那么Median RTT就是第十个包的RTT;如果有5个包丢失的话,那么MedianRTT就是第八个返回的包的RTT值。
(3) Avg RTT:它是每一个测试回合中所有RTT的算术评价值。
(4) Avg pkt loss:丢包率。
(5) Probe:100ICMP Echo Pings(56 Bytes)every300s每一个绿色的短横线都是一个测试回合300秒内用ping测试100次。绿色画出的是中间数的位置,一个回合中的其它值都在它附近被以灰度的形式被刻画;
下面来部署一下smokeping,首先把selinux,防火墙关闭掉systemctl stopfirewalld.service
时间同步方式如下:
yum install rdate-y
vi/etc/sysconfig/clock
ZONE=”Asia/Shanghai”
ln -sf/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
/usr/bin/rdate -stime.nist.gov
1、安装依赖包
yum groupinstall"Compatibility libraries" "Base" "Developmenttools" -y #安装需要的组件,保证环境一致性
yum install -y perlperl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSLperl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perlcurl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pangopango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpllibart_lgpl-devel perl-CGI-SpeedyCGI perl-Sys-Syslog popt-devel libidn-develfping
2、安装smokeping-2.6.8.tar.gz
wgethttp://pkgs.fedoraproject.org/repo/pkgs/smokeping/smokeping-2.6.8.tar.gz/md5/14a968daab2d17a27d41600077e3e967/smokeping-2.6.8.tar.gz
tar xvfsmokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./setup/build-perl-modules.sh/usr/local/smokeping/thirdparty
./configure--prefix=/usr/local/smokeping
/usr/bin/gmake install
/usr/bin/gmake install #重要的安装来两遍
3、配置修改
cd/usr/local/smokeping/
mkdir cache datavar
touch/var/log/smokeping.log
chown apache:apachecache data var
chown apache:apache/var/log/smokeping.log
chmod 600/usr/local/smokeping/etc/smokeping_secrets.dist
cd /usr/local/smokeping/htdocs
mvsmokeping.fcgi.dist smokeping.fcgi
cd/usr/local/smokeping/etc
mv config.distconfig
4、apache配置修改
修改主配置文件
vim/etc/httpd/conf/httpd.conf
DocumentRoot"/var/www/html" ==>>DocumentRoot "/usr/local/smokeping"
<Directory"/var/www/html"> ==>><Directory"/usr/local/smokeping">
增加somekping配置
vim/etc/httpd/conf.d/somekping.conf
Alias /cache"/usr/local/smokeping/cache/"
Alias /cropper"/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping"/usr/local/smokeping/htdocs/smokeping.fcgi"
<Directory"/usr/local/smokeping">
AllowOverride None
Options All
AddHandlercgi-script .fcgi .cgi
Orderallow,deny
Allow from all
DirectoryIndexsmokeping.fcgi
</Directory>
systemctl restarthttpd
访问测试一下
到此smokeping搭建完毕,现在还不能正常使用,需要进行配置。
vim/usr/local/smokeping/etc/config
cgiurl = http://some.url/smokeping.cgi==>cgiurl =http://x.x.x.x/smokeping.cgi
#注意x.x.x.x为本机IP请根据实际情况进行修改
step = 300 ==> step = 60
pings = 20 ==> pings = 10
#修改频率
删除默认的test数据
+ Test
menu= Targets
#parents =owner:/Test/James location:/
++ James
menu = James
title =James
alerts = someloss
slaves = boomerslave2
host =james.address
++ MultiHost
menu = Multihost
title = James andJames as seen from Boomer
host = /Test/James/Test/James~boomer
##添加如下数据并保存
+ Other
menu = 三大网络监控
title = 监控统计
++ dianxin
menu = 电信网络监控
title = 电信网络监控列表
###multi-graph#####
alerts = someloss
host =/Other/dianxin/dianxin-bj /Other/dianxin/dianxin-tj /Other/dianxin/dianxin-sc/Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz
+++ dianxin-bj
menu = 北京电信
title = 北京电信
alerts = someloss
host =202.96.199.133
+++ dianxin-tj
menu = 天津电信
title = 天津电信
alerts = someloss
host =219.150.32.132
+++ dianxin-sc
menu = 四川电信
title = 四川电信
alerts = someloss
host = 61.139.2.69
+++ dianxin-sh
menu = 上海电信
title = 上海电信
alerts = someloss
host =116.228.111.118
+++ dianxin-gz
menu = 广东电信
title = 广东电信
alerts = someloss
host =113.111.211.22
++ liantong
menu = 联通网络监控
title = 联通网络监控列表
host = /Other/liantong/liantong-bj /Other/liantong/liantong-tj /Other/liantong/liantong-sc
/Other/liantong/liantong-sh /Other/liantong/liantong-gz
+++ liantong-bj
menu = 北京联通
title = 北京联通
alerts = someloss
host =61.135.169.121
+++ liantong-tj
menu = 天津联通
title = 天津联通
alerts = someloss
host = 202.99.96.68
+++ liantong-sc
menu = 四川联通
title = 四川联通
alerts = someloss
host = 119.6.6.6
+++ liantong-sh
menu = 上海联通
title = 上海联通
alerts = someloss
host = 210.22.84.3
+++ liantong-gz
menu = 广东联通
title = 广东联通
alerts = someloss
host = 221.5.88.88
++ yidong
menu = 移动网络监控
title = 移动网络监控列表
host = /Other/yidong/yidong-bj /Other/yidong/yidong-tj /Other/yidong/yidong-sc /Other/yidong/yidong-sh /Other/yidong/yidong-gz
+++ yidong-bj
menu = 北京移动
title = 北京移动
alerts = someloss
host =221.130.33.52
+++ yidong-tj
menu = 天津移动
title = 天津移动
alerts = someloss
host =211.137.160.5
+++ yidong-sc
menu = 四川移动
title = 四川移动
alerts = someloss
host = 218.201.4.3
+++ yidong-sh
menu = 上海移动
title = 上海移动
alerts = someloss
host =117.131.19.23
+++ yidong-gz
menu = 广东移动
title = 广东移动
alerts = someloss
host =211.136.192.6
+是第一层,++是第二层,+++ 是第三层,添加监控节点一定要按照此规范
此时如果启动的话中文会出现乱码情况,所以先解决再启动
字符集的修改
vim/usr/local/smokeping/etc/config
*** Presentation***
charset =utf-8
#在Presentation 下添加charset = utf-8然后保存退出
yum -y installwqy-zenhei-fonts #安装字体包
vim/usr/local/smokeping//lib/Smokeping/Graphs.pm
my $val = 0;
for my $host (@hosts){
my ($graphret,$xs,$ys) =RRDs::graph
("dummy",
'--start', $tasks[0][1],
'--end', $tasks[0][2],
'--font TITLE:20""', #增加这一行
"DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
'PRINT:maxping:MAX:%le' );
my $ERROR = RRDs::error();
最后启动smokeping
/usr/local/smokeping/bin/smokeping
访问即可查看中文
查看网络状况
Smokeping可以方便地查看所监控的网络状况:
(1)可以很具体在图上看出网络的延迟及丢包等状况;
(2)具有Last 3 Hours,Last 30 Hours,Last 10 Days,Last 400 Days图像,还可以通过输入具体的时段来查看图像,如下所示:
(3) multi-graph在一张图里面画上多个监测点的数值,方便对照分析以及整体状况统计,如下所示:
(4)在“Charts”下可以查看“Top Packet Loss”,“Top Max RoundtripTime”,“Top Median Roundtrip Time”,“Top Standard Deviation”情况,这样可以相当方便地判断哪里的网络有问题,从而可以快速地作出处理。如下图所示:
转载于:https://blog.51cto.com/chenshoubiao/1881708