LoadRunner监控Linux资源

因为用的都是CentOS,就以它为例。 [shell] yum install portmap rsh-server rsh xinetd [/shell] 修改/etc/xinetd.d目录下面的3个conf (rlogin, rsh, rexec)文件,将文件中的disable均设置为no [shell]service portmap start service xinetd start rpc.rstatd[/shell] 检查rsh-server是否启动:监听的TCP端口514 [shell]netstat -an | grep 514[/shell] tcp        0      0 0.0.0.0:514                 0.0.0.0:*                   LISTEN      5310/xinetd 检查rstatd是否启动: [shell]rpcinfo -p[/shell]    程序 版本 协议   端口     100000    2   tcp    111  portmapper     100000    2   udp    111  portmapper     100001    5   udp    813  rstatd     100001    3   udp    813  rstatd     100001    2   udp    813  rstatd     100001    1   udp    813  rstatd 监控指标:[text] 度量                                                  描述 Average load 上一分钟同时处于“就绪”状态的平均进程数 Collision rate 每秒钟在以太网上检测到的冲突数 Context switches rate 每秒钟在进程或线程之间的切换次数 CPU utilization CPU 的使用时间百分比 Disk rate 磁盘传输速率 Incoming packets error rate    接收以太网数据包时每秒钟接收到的错误数 Incoming packets rate 每秒钟传入的以太网数据包数 Interrupt rate 每秒内的设备中断数 Outgoing packets errors rate   发送以太网数据包时每秒钟发送的错误数 Outgoing packets rate  每秒钟传出的以太网数据包数 Page-in rate  每秒钟读入到物理内存中的页数 Page-out rate 每秒钟写入页面文件和从物理内存中删除的页数 Paging rate 每秒钟读入物理内存或写入页面文件的页数 Swap-in rate 正在交换的进程数 Swap-out rate 正在交换的进程数 System mode CPU utilization  在系统模式下使用 CPU 的时间百分比 User mode CPU utilization  在用户模式下使用 CPU 的时间百分比[/text] 如何监控网卡资源呢?可以使用nload,nload在监控大流量时会出现错误(流量为负)而且进行数据分析的时候比较麻烦。另外一个方法就是使用loadrunner的snmp在线监控器获得网络流量,得到的值是网络的平均字节流量和最大字节流量。那就开始吧。 一、在被测试服务器上面安装snmp服务: 1.yum install net-snmp -y或者安装net-snmp的rpm包 2.修改snmpd.conf文件 vi /etc/snmp/snmpd.conf    A、修改默认的community string        com2sec notConfigUser default public             将public修改为你才知道的字符串(如果这里改了,需要在<loadRunnerrootfolder>\dat\monitors\snmp.cfg文件里更改snmp_community_name)    B、把下面的#号去掉 #view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc    C、把下面的语句    access notConfigGroup "" any noauth exact systemview none none    改成:    access notConfigGroup "" any noauth exact mib2 none none 如果不做B、C的操作,也可以将 view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 修改为: view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.2 view systemview included .1.3.6.1.2.1.25.1.1 MIB-2里相关网络流量的interface组是.1.3.6.1.2.1.2  3.重启snmpd   service snmpd restart 4.确保Linux的iptables防火墙对流量监控服务器开放了udp 161端口的访问权限 可以编辑 vi /etc/sysconfig/iptables文件 并重启iptables服务 二、loadrunner通过system Resource下的snmp来获得网络流量 主要就是取mib-2库里面的ifInOctets 输入字节数、ifOutOctets 输出字节数 (服务器有几个网络接口就会有几个) MIB-2里相关网络流量的是interface组 主要管理如下信息: [text]ifIndex 端口索引号 ifDescr 端口描述 ifType 端口类型 ifMtu 最大传输包字节数 ifSpeed 端口速度 ifPhysAddress 物理地址 ifOperStatus 操作状态 ifLastChange 上次状态更新时间 *ifInOctets 输入字节数 *ifInUcastPkts 输入非广播包数 *ifInNUcastPkts 输入广播包数 *ifInDiscards 输入包丢弃数 *ifInErrors 输入包错误数 *ifInUnknownProtos 输入未知协议包数 *ifOutOctets 输出字节数 *ifOutUcastPkts 输出非广播包数 *ifOutNUcastPkts 输出广播包数 *ifOutDiscards 输出包丢弃数 *ifOutErrors 输出包错误数 ifOutQLen 输出队长 其中,*号标识的是与网络流量有关的信息。[/text]
posted @ 2011-01-15 18:10  刘光明  阅读(333)  评论(0编辑  收藏  举报