什么是smoking ping
- smokeping是一款监控网络状态和稳定性的开源软件(它是rrdtool的作者开发的),通过它可以监控到公司IDC的网络状况,如延时,丢包率,是否BGP多线等;
smokeping会向目标设备和系统发送各种类型的测试数据包,测量、记录,并通过rrdtool制图方式,图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况;
1. 安装依赖环境
yum install -y perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel
2. 下载fping并编译:(或上传)
wget http://fping.org/dist/fping-3.10.tar.gz
tar xf fping-3.10.tar.gz
cd fping-3.10f
./configure
make && make install
3.下载好的echoping并编译安装:(或上传)
- rz 上传echoping源码包
tar xf echoping-6.0.2.tar.gz
cd echoping-6.0.2
yum install -y popt popt-devel
yum install -y libidn libidn-devel (安装两个echoping依赖的包)
./configure
make && make install
2.下载smokeping
http://download.csdn.net/download/fairplay_li/8711829
cd smokeping-2.6.9
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
3.以下开始配置 smokeping
cd /usr/local/smokeping/
mkdir cache data var
touch /var/log/smokeping.log
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
cd /usr/local/smokeping/htdocs
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
mv config.dist config
vim config
4.主要修改如下内容:
#cgiurl = http://some.url/smokeping.cgi
cgiurl = http://172.27.85.115/smokeping.cgi
*** Database ***
#step = 300
step = 60 #此处建议改为 60 , 一分钟采集一次数据
pings = 20
5.修改httpd配置
vim /etc/httpd/conf/httpd.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
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
DirectoryIndex smokeping.fcgi
</Directory>
6.如果需要支持中文,需要安装中文编码:
yum -y install wqy-zenhei-fonts.noarch
vim /usr/local/smokeping/etc/config
*** Presentation ***
charset = utf-8 #添加此行
vim /usr/local/smokeping/lib/Smokeping/Graphs.pm
#第148行下边插入下边一行
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',
- 设置开机启动
echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
- 添加到
#################################################测试数据
## 7.监测源的IP库,填入到 config 中
vim /usr/local/smokeping/etc/config
+ Other
menu = 美国西部硅谷网络监控
title = 美国西部硅谷监控网络监控
++ web
menu = 美国西部硅谷google网站网络监控
title = 谷歌网络监控
host = /Other/web/google
+++ google
menu = 美国西部硅谷谷歌
title = 美国西部硅谷谷歌
host = 172.217.13.68
++ dns
menu = 美国西部硅谷DNS网络监控
title = 美国西部硅谷DNS网络监控
host = /Other/dns/dnsip
+++ dnsip
menu = 美国西部硅谷dns
title = 美国西部硅谷dns
host = 151.202.0.84
++ us
menu = 美国西部硅谷网络监控
title = 美国西部硅谷网络监控
host = /Other/us/guigu
+++ guigu
menu = 阿里云美国东部弗吉尼亚
title = 阿里云美国东部弗吉尼亚
host = 47.89.181.166
host = 116.228.111.118
+++ dianxin-gz
menu = 广东电信
title = 广东电信
alerts = someloss
host = 113.111.211.22
8.smokeping的默认配置文件110行的fping安装目录与此次安装目录不相符需修改!
vim /usr/local/smokeping/etc/config
第110更改fping的目录为
binary = /usr/local/sbin/fping
9.启动apache和smokeping&设置环境变量
/etc/init.d/httpd restart /etc/init.d/httpd start
/usr/local/smokeping/bin/smokeping
10.添加环境变量
echo 'export PATH=/usr/local/smokeping/bin/:$PATH' >> /etc/profile