一、apache配置步骤(假设apache服务已安装)
1.使用find / -name httpd.conf命令查找httpd.conf文件
2.使用cd opt/lampp/apache2/conf/命令进入到conf目录
3.使用vi httpd.conf命令打开httpd.conf文件
4.添加以下代码,设置允许查看Apache运行状态的主机,效果如图
LoadModule status_module modules/mod_status.so
SetHandler server-status
Order allow,deny
Deny from nothing
Allow from all
</Location>
SetHandler server-info
Order allow,deny
Deny from nothing
Allow from all
</Location>
5.保存并退出后,使用/opt/lampp/bin/httpd -k restart重新启动Apache
6.在浏览器中输入http://172.16.250.191/server-status可看到Apache运行时信息,效果如下图
7.输入http://172.16.250.191/server-status?auto可看到下图效果
以上对apache配置就已经完成啦!
二、Loadrunner配置步骤
1.将controller中Web Server Resource Graphs下的apache服务添加到右侧监控窗口中
2.右键该窗口,选择Add Measurements...,输入要监控的服务器地址及监控的指标,效果如下图
以上对loadrunner配置也已经完成啦!
三、可能遇到的问题及处理方式
报错信息:【Monitor name :Apache. Parsing error, cannot find token: BusyServers. Measurement: BusyServers|192.168.0.186. Hints: 1) Such a measurement does not exist, or the html page may be different from the supported one. 2) Try to replace the Apache.cfg with appropriate Apache_<version>.cfg file in <Installation>\dat\monitors and rerun the application (entry point: CApacheMeasurement::NewData). [MsgId: MMSG-47479]】,这是由于要监视Apache的版本提供的计数器与LoadRunner默认的计数器不一致导致的。此时建议先关闭Controller,打开<Installation>HP\LoadRunner\dat\monitors下的apache.cfg文件(其它文件名类似Apache_<version>.cfg的是Apache监视配置的备份,只有apache.cfg是生效的):
1.修改Counter0=IdleServers为Counter0=IdleWorkers,同时修改注释信息Label0=#Idle Servers (Apache)为Label0=#Idle Workers (Apache),描述信息也建议修改;
2. 修改Counter4=BusyServers为Counter4=BusyWorkers,同时修改注释信息Label4=#Busy Servers (Apache)为Label4=#Busy Workers (Apache) ,描述信息也建议修改。
3.然后保存并关闭该文件,重新打开Controller并添加计数器,这样监视就正常了。
本文借鉴文章:https://igoole.iteye.com/blog/576700