场景设计-添加UnixLinux Resources计数器

by:授客 QQ1033553122

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  ]

[root@localhost ~]# rpcinfo -p localhost

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,添加

5.右键已经添加的Unix Resource, 选择Add Measurements...

6.弹出窗口中,点击Add,弹出Add
Machine中添加要监控系统((通常是压测目标服务器)的IP

保存

结果提示错误消息:

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:                                          

OK 
]

Starting xinetd:                                          

OK 
]

[root@localhost ~]# service rstatd restart

Stopping rstat services:                      
            [FAILED]

Starting rstat services:                                  

OK 
]

[root@localhost ~]# service rstatd restart

Stopping rstat services:                                  

OK 
]

Starting rstat services:                               
   [ 
OK 
]

[root@localhost ~]# service rstatd restart

说明:具体是否一定要按这个顺序重启服务就不清楚了,测试中,开放防火墙tcp\udp
111端口,重启过xinetd服务后添加再重新Unix
rescource发现还是不行,接着,关闭防火墙->重启xinetd->重启rstatd服务,再次添加就可以了,这里根据上述执行情况,估计是之前启动rstatd后“rpc.rstatd
dead but pid file exists”造成的(注意:后面测试发现,一开启防火墙就没数据了……

4)重复上述的5-6操作步骤,OK

最新文章

  1. 转载:Android横屏竖屏切换的问题
  2. Bitmap四种属性
  3. 2008---2009学年(A)B)第1学期《中国近代史纲要》课程考核试卷
  4. PHP中PDO DEMO
  5. [Hapi.js] Friendly error pages with extension events
  6. HTTP POST和GET的区别[转]
  7. android 高效显示Bitmap - 开发文档翻译
  8. msp430系统时钟
  9. jQuery对象与DOM对象互相转换
  10. 腾讯云ping wget yum 常用命令设置问题
  11. Eclipse 中 Debug 调试 java 代码一直报 Source not found
  12. fjwc2019 D6T1 堆(组合数+打表)
  13. puppet替换文件中的string
  14. 无需AutoCAD,用C#生成DWG文件
  15. Angular build Error:In this configuration Angular requires Zone.js
  16. asp.net web api 跨域,带cookie
  17. windows从0开始学golang--0--安装golang+git+自己写包
  18. LeetCode: Word Break II 解题报告
  19. Julia 1.0 中文文档
  20. java 多线程 day01 创建线程

热门文章

  1. 仿B站项目——(1)计划,前端工程
  2. Apache重写规则
  3. iptables概述
  4. 使用pyenv来管理python版本
  5. 课程四(Convolutional Neural Networks),第四 周(Special applications: Face recognition & Neural style transfer) —— 2.Programming assignments:Art generation with Neural Style Transfer
  6. 批量去除文件的BOM头
  7. PowerShell 连接远程服务器
  8. an error occurred attempting install_Github_for_windows_无法安装的解决方法_
  9. Python爬取网易云歌单
  10. 高可用Hadoop平台-Oozie工作流