安装:
1. 先以root登陆要安装load generator的unix服务器。(目前仅支持uname=linux,SunOS,AIX,HP-UX)
2. 将LR的unix插件copy到服务器上并解压。
3. 运行install.sh 的脚本调起安装的wizard。 Next->Agree->Confirm Install->Finish (安装的log写在/tmp目录下)
4. 检查目录/opt/HP/HP_LoadGenerator (这个就是loadruner的服务器端插件的主目录了)
5. 设置设置几个环境变量
LR自带的是csh下的脚本,bash的脚本自己写,然后设置好切shell的时候自动source相应的脚本执行。
CSH下的脚本:
#!/bin/csh
setenv PRODUCT_DIR /opt/HP/HP_LoadGenerator
setenv M_LROOT $PRODUCT_DIR
if ( `uname` == SunOS ) then
setenv LD_LIBRARY_PATH ${M_LROOT}/bin
else if ( `uname` == Linux ) then
setenv LD_LIBRARY_PATH${M_LROOT}/bin:${M_LROOT}/lib:/usr/lib
else if ( `uname` == AIX ) then
setenv LIBPATH ${M_LROOT}/bin
else if ( `uname` == HP-UX ) then
setenv SHLIB_PATH ${M_LROOT}/bin
endif
setenv DISPLAY 0.0
setenv PATH ${M_LROOT}/bin:$PATH
注意:
1.这里Loadrunner原始的脚本给LD_LIBRARY_PATH的设置的值是${M_LROOT}/bin,实则library应该指向安装目录的/opt/HP/HP_LoadGenerator/lib下。
因此给LD_LIBRARY_PATH设置值为
${M_LROOT}/bin:${M_LROOT}/lib:/usr/lib (这里M_LROOT=/opt/HP/HP_LoadGenerator)
2.原始Loadrunner只提供了CSH的脚本,bash的自己写一份了,下面是自己写的
BASH的脚本
#!/bin/bash
export PRODUCT_DIR=/opt/HP/HP_LoadGenerator
export M_LROOT=$PRODUCT_DIR
exportLD_LIBRARY_PATH=$M_LROOT/bin:$M_LROOT/lib:/usr/lib
export DISPLAY='0.0'
export PATH=$PATH:$M_LROOT/bin
注:没按照原始文件根据uname判断来给LD_LIBRARY_PATH执行不同的值。
6. 在不同shell的配置里source这两个文件使得切换shell后执行 (以下方法仅适用于CENTOS-linux系统)
CSH
给文件/etc/csh.cshrc最后增加 source/opt/HP/HP_LoadGenerator/env.csh
BASH
给文件/etc/profile 最后增加 source/opt/HP/HP_LoadGenerator/env.sh
7.切换SHELL 让source的程序文件执行生效或自己手动执行
8.检查loadrunner配置环境
进入/opt/HP/HP_Loadrunner/bin下,运行verify_generator
[jaunty@localhost bin]$ csh
===================================================
HP
Vuser Environment Verification Utility
===================================================
Product: HP LoadRunner 9.50
Version: 09.50.0000
Build: 3378
localhost.localdomain:
提示找不到libstdc++.so.5,就是缺libstdc++5相关包
解决办法:
yum -y install libstdc++.so.5
安装libstdc++时出现的问题:
ccc安装的是:compat-libstdc++-33.x86_64
有的安装的是:libstdc++-devel-4.1.2-46.el5_4.2.x86_64.rpm
/opt/HP/HP_LoadGenerator/bin/lrv/chk_thread_lmt:error while loading shared libraries: libstdc++.so.5: cannot open shared objectfile: No such file or directory
/opt/HP/HP_LoadGenerator/bin/lrv/limithost:line 134: [: : integer expression expected
verify_generator...OK
/opt/HP/HP_LoadGenerator/bin/lrv/chk_sems_lmt:error while loading shared libraries: libstdc++.so.5: cannot open shared objectfile: No such file or directory
/opt/HP/HP_LoadGenerator/bin/lrv/limithost:line 154: [: : integer expression expected
verify_generator...OK
verify_generator...OK
Don't forget to make sure that the name ofthe controller machine
is also in .rhosts
Verify $M_LROOT ...Failed
_____It was not possible to set the$M_LROOT from
_____the shell dot files. One of severalthings might be happening:
_____1) $M_LROOT is not set at all in theshell dot files.
_____2) There is some error in the shelldot files which stops their execution
_____ before it sets $M_LROOT.
_____3) There is conditional code in theshell dot files (most likely related to
_____ interactive and non interactiveshells) and $M_LROOT is set
_____ only in one of the sections.
_____Aborting virtual user tests on hostlocalhost.localdomain
verify_generator...OK
_______________________________________________
Summary:
________
Vuser Host localhost.localdomain: Failed
只要verify 都通过没有错就可以了。如果其他的没错仅有Verify$M_LROOT ...Failed ,也可以继续使用。
9. 确认防火墙已经关闭
10.运行 m_daemon_setup -install 成功会获取一个 processed
遇到的问题:verify时通过但install时却报libstdc++.so.5找不到。
PS -auxww| grep m_agent
可以看到启动起来的进程信息
11.然后在本地的pc测试机里打开controller,设置load generator 不用RSH ,连接后变为ready 成功.
12.如果本地connet不上,则先检查服务器和本地测试pc之间的网络互通性再检查两端的防火墙设置。如果还有问题则可在服务器的/tmp目录下看到很多Loadruneragent产生的log,根据时间定位,打开查看细节问题。
卸载:
执行/var/opt/HP/iHP/HP_LoadGenerator/9.50.000/installer.sh
按提示操作。即可卸载成功。
问题:
1.若使用RSH连接,则负载机必安装RSH并正确配罿,正如检测过程中描述的"Don't forget to make sure that the name of the controllermachine”。
2.补充,Linux下似乎只支持Web/Http协议的脚本。譬如WinSock协议,从名称上都知道只适合Windows
“Error (-81024): LR_VUG: The 'WinSock' type is not supportedon 'LINUX' platforms .”
另外试了Java协议,确实不行,报错如下
“Error (-81024):LR_VUG: The 'General-Java' type is not supported on 'LINUX' platforms .”
3.依赖库:yum -y --disablerepo=\* --enablerepo=AutoInstaller --nogpgcheck--skip-broken localinstall/mnt/CentOS_Final/CentOS/compat-libstdc++-33-3.2.3-61.i386.rpm
否则会报:”m_agent_daemon: error while loading shared libraries:libstdc++.so.5: cannot open shared object file: No such file or directory”
4.注意hosts文件的配置,如果机器名和hosts里配置不一致也会导致LoadRunner启动失败
譬如"Error: Communication error: Failed to get the server host IP bycalling the gethostbyname function.”
5.运行verify_generator时提示/tmp/host.文件权限不够。因/tmp文件夹只有root用户有写权限,权限更改a+x后解决。