1. 安装Tsung所需要的环境
- erlang安装:
sudo yum install erlang erlang-src
安装完之后,输入[sunwei@vdevops ~]$ erl 出现:
[sunwei@vdevops ~]$ erl
Erlang/OTP 19 [erts-8.2] [source-fbd2db2] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.2 (abort with ^G)
1>
表示安装成功
- gnuplot 、perl5安装:
sudo yum -y install perl #一般服务器都会安装perl : perl -v查看版本
sudo yum -y install gnuplot # gnuplot 命令查看版本
2. 安装Tsung
[sunwei@vdevops ~]$ wget http://tsung.erlang-projects.org/dist/tsung-1.6.0.tar.gz #下载压缩包
[sunwei@vdevops ~]$ tar -zxvf tsung-1.6.0.tar.gz #解压缩
[sunwei@vdevops ~]$ cd tsung-1.6.0 #进入解压缩的目录
[sunwei@vdevops tsung-1.6.0]$ ./configure --prefix=/usr/local/tsung #设置编译安装的目录
#编译安装
[sunwei@vdevops tsung-1.6.0]$ make
[sunwei@vdevops tsung-1.6.0]$ make install
验证Tsung是否已经安装:
[sunwei@vdevops ~]$ sudo ln -s /usr/local/tsung/bin/tsung /usr/bin/
[sudo] password for sunwei:
[sunwei@vdevops tsung]$ tsung
Usage: tsung <options> start|stop|debug|status
Options:
-f <file> set configuration file (default is ~/.tsung/tsung.xml)
(use - for standard input)
-l <logdir> set log directory where YYYYMMDD-HHMM dirs are created (default is ~/.tsung/log/)
-i <id> set controller id (default is empty)
-r <command> set remote connector (default is ssh)
-s enable erlang smp on client nodes
-p <max> set maximum erlang processes per vm (default is 250000)
-X <dir> add additional erlang load paths (multiple -X arguments allowed)
-m <file> write monitoring output on this file (default is tsung.log)
(use - for standard output)
-F use long names (FQDN) for erlang nodes
-L <lifetime> SSL session lifetime (600sec by default)
-w <delay> warmup delay (default is 1 sec)
-n disable web GUI (started by default on port 8091)
-k keep web GUI (and controller) alive after the test has finished
-v print version information and exit
-6 use IPv6 for Tsung internal communications
-x <tags> list of requests tag to be excluded from the run (separated by comma)
-h display this help and exit
至此Tsung安装完成
示例xml脚本目录:
/usr/local/tsung/share/doc/tsung/examples
2. 进行tigase的压测
1.在根目录下新建tsungTest文件夹:[sunwei@vdevops ~]$ mkdir tsungTest
2.修改examples目录下的jabber_register.xml文件并拷贝到/tsungTest目录
3.在/tsungTest目录下执行tsung: tsung –f jabber_register.xml start
4.查看tsung的测试报告:
- 4.1进入需要生成图形报表的Log目录:/home/sunwei/.tsung/log/20170822-1944
- 4.2在该目录下执行
[sunwei@vdevops 20170822-1944]$ /usr/local/tsung/lib/tsung/bin/tsung_stats.pl
一些问题:
在运行/usr/local/tsung/lib/tsung/bin/tsung_stats.pl时报错:
Can't locate Template.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/tsung/lib/tsung/bin/tsung_stats.pl line 570.
解决方法:
安装perl-Template-Toolkit
[sunwei@vdevops ~]$ sudo yum -y install perl-Template-Toolkit