天天看點

loadrunner 場景設計-添加Unix、Linux Resources計數器

場景設計-添加Unix、Linux Resources計數器

by:授客 QQ:1033553122

A.   目的

監控要測試的Unix、Linux伺服器的資源使用情況

Linux CentOS為例(Linux、Unix雖說大同小異,但是具體落實到配置等實際執行還是有差别的,以下僅供參考

注:關于Unix的配置,可以參見官方文檔“How to Set up the UNIX Monitoring Environment”

B.   步驟

1、确認伺服器是否配置并開啟了rstatd守護程序 

如果已經配置rstatd守護程序,當伺服器收到rstatd請求時,inetd程序會自動激活rstatd程序

可以利用下文的方法在不進行配置的情況下,添加Unix Rescources螢幕,檢視是否傳回相關資料,Scenario status傳回錯誤則說明伺服器未配置rstatd

2、安裝rpc.rstatd

配置本第yum源(略)

[root@localhost ~]# mount /dev/cdrom /mnt

[root@localhost ~]# yum grouplist | grep rusers

[root@localhost ~]# yum list | grep rusers

rusers.x86_64                           0.17-59.el6                      centos

rusers-server.x86_64                    0.17-59.el6                      centos

[root@localhost ~]# yum install rusers-server

……

3.啟動rstatd程序

[root@localhost ~]# /etc/init.d/rstatd start

Starting rstat services:                                   [  OK  ]

[root@localhost ~]# service rstatd status

rpc.rstatd dead but pid file exists

說明rstartd啟動後并不能保持運作狀态

[root@localhost ~]# rpcinfo -p localhost

rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused

原因分析:如下,未啟動portmap服務/很多linux發行版已經用rpcbind代替portmap服務了

[root@localhost ~]# service rpcbind status

rpcbind is stopped

[root@localhost ~]# service rpcbind start

Starting rpcbind:                                          [  OK  ]

   program vers proto   port  service

    100000    4   tcp    111  portmapper

    100000    3   tcp    111  portmapper

    100000    2   tcp    111  portmapper

    100000    4   udp    111  portmapper

    100000    3   udp    111  portmapper

100000    2   udp    111  portmapper

說明:

rpcinfo -p ,如果是遠端連接配接必須指定IP位址,

比如# rpcinfo -p 172.25.75.14

4、添加視圖,方法輕按兩下、拖動左側的Unix Rescources到右邊圖形區,或右鍵右側已有視圖,Open a New Graph,找到Unix Rescource,添加

loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器

5.右鍵已經添加的Unix Resource, 選擇Add Measurements...

loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器

6.彈出視窗中,點選Add,彈出Add

Machine中添加要監控系統((通常是壓測目标伺服器)的IP

loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器

儲存

結果提示錯誤消息:

Monitor name :UNIX Resources. Cannot initialize the monitoring on

172.25.75.14. Error while creating the RPC client. Ensure that the

machine can be connected and that it runs the rstat daemon (use

rpcinfo utility for this verification). Detailed error: RPC: Failed to create RPC

client.

RPC-TCP: Failed to establish RPC server address.

RPC-TCP: Failed to communicate with the portmapper on host

'172.25.75.14'.

RPC: RPC call failed.

RPC-TCP: recv()/recvfrom() failed.

RPC-TCP: Timeout reached. (entry point:

CFactory::Initialize).  [MsgId:

MMSG-47190]

解決方法

1)安裝xinetd服務

[root@localhost ~]# yum list | grep xinetd

xinetd.x86_64                          

2:2.3.14-29.el6                 

centos

[root@localhost ~]# yum install inetd

……

[root@localhost ~]# service xinetd status

xinetd is stopped

[root@localhost ~]# service xinetd start

Starting xinetd:                                          

OK 

]

2)關閉防火牆

[root@localhost ~]# service iptables stop

3)重新開機服務

[root@localhost ~]# /etc/init.d/xinetd restart #service xinetd

restart應該也可以

Stopping xinetd:                                          

[root@localhost ~]# service rstatd restart

Stopping rstat services:                      

            [FAILED]

Starting rstat services:                                  

Stopping rstat services:                                  

Starting rstat services:                               

   [ 

說明:具體是否一定要按這個順序重新開機服務就不清楚了,測試中,開放防火牆tcp\udp

111端口,重新開機過xinetd服務後添加再重新Unix

rescource發現還是不行,接着,關閉防火牆->重新開機xinetd->重新開機rstatd服務,再次添加就可以了,這裡根據上述執行情況,估計是之前啟動rstatd後“rpc.rstatd

dead but pid file exists”造成的(注意:後面測試發現,一開啟防火牆就沒資料了……

4)重複上述的5-6操作步驟,OK

loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器

作者:授客

QQ:1033553122

全國軟體測試QQ交流群:7156436

Git位址:https://gitee.com/ishouke

友情提示:限于時間倉促,文中可能存在錯誤,歡迎指正、評論!

作者五行缺錢,如果覺得文章對您有幫助,請掃描下邊的二維碼打賞作者,金額随意,您的支援将是我繼續創作的源動力,打賞後如有任何疑問,請聯系我!!!

           微信打賞                       

支付寶打賞                  全國軟體測試交流QQ群  

loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器
loadrunner 場景設計-添加Unix、Linux Resources計數器