码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS压力测试工具Tsung安装、使用和图形报表生成

时间:2015-03-11 18:57:14      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:

一、安装前检查环境

1、查看环境:

[root@localhost bin]#  lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 6.4 (Final)
Release:    6.4
Codename:    Final

2、确保安装了以下工具:

yum install gcc -y  
yum install perl -y  
yum install unixODBC  
yum install unixODBC-devel 

二、安装

1、下载并安装erlang

[root@localhost ~]#cd /usr/local
[root@localhost local]#mdir -p erlang

[root@localhost local]# wget http://www.erlang.org/download/otp_src_R14B04.tar.gz 
[root@localhost local]# tar -zxvf otp_src_R14B04.tar.gz  
[root@localhost local]# cd otp_src_R14B04  
[root@localhost otp_src_R14B04]# ./configure --prefix=/usr/local/erlang  
[root@localhost otp_src_R14B04]# make  
[root@localhost otp_src_R14B04]# make install  

注意:如果出现 "configure: error: No curses library functions found "错误,尝试安装:

[root@localhost otp_src_R14B04]#yum install -y ncurses-devel 

 

2、下载并安装Tsung

[root@localhost ~]#cd /usr/local
[root@localhost local]#mkdir -p tsung
[root@localhost local]# wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz [root@localhost local]# tar -zxvf tsung-1.4.2.tar.gz [root@localhost local]# cd tsung-1.4.2 [root@localhost tsung-1.4.2]# ./configure --prefix=/usr/local/tsung --with-erlang=/usr/local/erlang [root@localhost tsung-1.4.2]# make [root@localhost tsung-1.4.2]# make install

 

3、下载并安装perl Template,用于生成报告模版

[root@localhost ~]#cd /usr/local

[root@localhost local]# wget http://cpan.org/modules/by-module/Template/Template-Toolkit-2.24.tar.gz  
[root@localhost local]# tar -zxvf Template-Toolkit-2.24.tar.gz  
[root@localhost local]# cd Template-Toolkit-2.24  
[root@localhost Template-Toolkit-2.24]# perl Makefile.PL  
[root@localhost Template-Toolkit-2.24]# make  
[root@localhost Template-Toolkit-2.24]# make test  
[root@localhost Template-Toolkit-2.24]# make install  

 

4、下载并安装gnuplot,用于聊天生成

[root@localhost local]#yum install -y gnuplot gd libpng zlib 

 

三、安装后设置环境变量

安装成后添加erlang、tsung环境变量

[root@localhost local]# vim /etc/profile   
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/erlang/bin:/usr/local/tsung/bin:/usr/local/nginx/sbin:$PATH(修改自己实际变量)  
:wq保存,退出  
[root@localhost local]# source /etc/profile   
不报错则成功  
[root@localhost local]# tsung -v   
Tsung version 1.4.2
[root@localhost local]# erl -v  
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.5 (abort with ^G)
1>

 

四、使用并生成报表

1、在root文件夹下新建.tsung目录,用于存放log和xml配置,测试配置文件可参考/usr/local/tsung/share/doc/tsung/examples/目录下配置

[root@localhost local]#mkdir ~/.tsung
[root@localhost local]#cp /usr/local/tsung/share/doc/tsung/examples/http_simple.xml ~/.tsung/tsung.xml

2、运行,默认执行脚本~/.tsung/tsung.xml配置

[root@localhost local]# tsung start
Starting Tsung
"Log directory is: /root/.tsung/log/20150311-0536"

3、进入Log目录下可以看到生成的报表信息

[root@localhost 20150311-0536]# cd /root/.tsung/log/20150311-0536
[root@localhost 20150311-0536]# ls -a
.  ..  match.log  tsung_controller@localhost.log  tsung.log  tsung.xml

4、进入需要生成图形报表的Log目录,如/root/.tsung/log/20150311-0536

[root@localhost 20150311-0536]# /usr/local/tsung/lib/tsung/bin/tsung_stats.pl 
creating subdirectory data 
creating subdirectory gnuplot_scripts 
creating subdirectory images 
No data for Session
No data for Perfs
No data for Transactions
No data for Match
No data for Event
No data for Async
No data for Size
size_rcv is equal to 0 !
size_sent is equal to 0 !
[root@localhost 20150311-0536]# ls
data  gnuplot.log  gnuplot_scripts  graph.html  images  match.log  report.html  tsung_controller@localhost.log  tsung.log  tsung.xml

5、将report.html拖到windows系统中,直接打开即可查看。

 

CentOS压力测试工具Tsung安装、使用和图形报表生成

标签:

原文地址:http://www.cnblogs.com/yangxia-test/p/4330571.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!