最近公司新机房搬迁,需要测试新机房和各地机房之间的网络性能,选择了smokeping这个网络性能测试工具,部署的时候参考了网上的很多文章,现将部署步骤记录如下:
1、安装其他源
rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2、安装rrdtool与依赖库
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perl curl fping echoping 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 mod_fastcgi
3、下载与安装smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz tar zxvf smokeping-2.6.8.tar.gz cd smokeping-2.6.8 ./configure --prefix=/usr/local/smokeping 可能需要安装perl的模块,运行下面内容即可 ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty ./configure --prefix=/usr/local/smokeping /usr/bin/gmake install 至此,smokeping安装完成。
4、配置smokeping
4.1.创建cache、data、var目录
cd /usr/local/smokepingmkdir cache data var
4.2.在创建日志
touch /var/log/smokeping.log
4.3.授权
chown apache:apache cache data varchown apache:apache /var/log/smokeping.log
4.4.修改配置文件
cd /usr/local/smokeping/htdocs/ mv smokeping.fcgi.dist smokeping.fcgi cd /usr/local/smokeping/etc mv config.dist config vim config cgiurl = http://some.url/smokeping.cgi(将some.url修改为你的ip或者域名)
*** Database *** step = 300 (检测时间,修改step,从300改为60)
4.5.配置完成之后修改密码文件权限
chmod600 /usr/local/smokeping/etc/smokeping_secrets.dist
4.6.修改apache的配置
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>
f.设置开机启动
echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
g.启动http与smokeping
/etc/init.d/httpd start/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 & 然后访问 如果出现500错误,是因为没有关闭selinux的问题,关闭之后就能正常访问。 5.安全性设置:访问控制。 修改/etc/httpd/conf/httpd.con里的内容 <Directory "/usr/local/smokeping"> AllowOverride None Options All AddHandler cgi-script .fcgi .cgi AllowOverride AuthConfigOrder allow,deny Allow from allAuthName "Smokeping"AuthType Basic AuthUserFile /usr/local/smokeping/htdocs/htpasswd Require valid-userDirectoryIndex smokeping.fcgi </Directory> 把之前修改的httpd.conf里的这一段直接覆盖即可 然后进入cd /usr/local/smokeping/htdocs目录,设置登录账户与密码 htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin 最后重启httpd就可以实现密码验证登录。 6.一些细节 6.1 同步好时间, cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ntpdate 210.72.145.44。 6.2 网页乱码问题 如果需要在网页里展示中文,修改/usr/local/smokeping/etc的config文件 *** Presentation *** charset = utf-8 然后在menu与titile里修改中文,重启即可 7.配置文件 采用分层的结构,很容易配置。
本文出自 “Scorpio” 博客,请务必保留此出处http://secscorpio.blog.51cto.com/8813230/1675734
原文地址:http://secscorpio.blog.51cto.com/8813230/1675734