LR监控linux之详解rstatd的安装
1.前期准备:
1,把rstatd文件解压到要监控的机器上。2,打开终端,定位到rstatd文件夹下:查看文件夹中的内容如下:[root@localhost rpc.rstatd]# lsaclocal.m4 COPYING Makefile.am README rstat_proc.c rup.1config.h.in CVS Makefile.in rpc.rstatd.8 rstat.x rup.cconfigure INSTALL missing rstatd.8 rsysinfo.1 stamp-h.inconfigure.in install-sh mkinstalldirs rstat_main.c rsysinfo.c2.执行如下步骤:
2.1.执行:./configure 命令
[root@localhost rpc.rstatd]# ./configurecreating cache ./config.cachechecking for a BSD compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking whether make sets ${MAKE}... yeschecking for working aclocal... foundchecking for working autoconf... foundchecking for working automake... foundchecking for working autoheader... foundchecking for working makeinfo... foundchecking for gawk... gawkchecking for gcc... gccchecking whether the C compiler (gcc ) works... yeschecking whether the C compiler (gcc ) is a cross-compiler... nochecking whether we are using GNU C... yeschecking whether gcc accepts -g... yeschecking for a BSD compatible install... /usr/bin/install -cchecking whether ln -s works... yeschecking whether make sets ${MAKE}... (cached) yeschecking how to run the C preprocessor... gcc -Echecking for sys/ioctl.h... yeschecking for syslog.h... yeschecking whether time.h and sys/time.h may both be included... yeschecking whether gcc needs -traditional... nochecking for ANSI C header files... yeschecking return type of signal handlers... voidupdating cache ./config.cachecreating ./config.statuskcreating Makefilecreating config.h
2.2.执行:make 命令。[root@localhost rpc.rstatd]# makerm -f rstat.hrpcgen -h -o rstat.h rstat.xgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rup.crup.c: In function 'ointopoint_v5':rup.c:256: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer typerup.c: In function 'ointopoint_v3'?rup.c:292: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer typerup.c: In function 'main'?rup.c:317: warning: return type of 'main'?is not 'int'?rm -f rstat_xdr.crpcgen -c -o rstat_xdr.c rstat.xgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rstat_xdr.crm -f rstat_clnt.crpcgen -l -o rstat_clnt.c rstat.xgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rstat_clnt.cgcc -g -O2 -o rup rup.o rstat_xdr.o rstat_clnt.ogcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rsysinfo.crsysinfo.c: In function 'ointopoint_v3'?rsysinfo.c:136: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer typersysinfo.c: In function 'main'?rsysinfo.c:160: warning: return type of 'main'?is not 'int'?gcc -g -O2 -o rsysinfo rsysinfo.o rstat_xdr.o rstat_clnt.orm -f rstat_svc.crpcgen -m -o rstat_svc.c rstat.xgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rstat_svc.cgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rstat_proc.cgcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c rstat_main.crstat_main.c: In function 'main'?rstat_main.c:82: warning: return type of 'main'?is not 'int'?gcc -g -O2 -o rpc.rstatd rstat_svc.o rstat_xdr.o rstat_proc.o rstat_main.o
这之后可以执行:make check检查一下。2.3.执行:make install 命令。
[root@localhost rpc.rstatd]# make installmake[1]: Entering directory `/opt/rpc.rstatd'/bin/sh ./mkinstalldirs /usr/local/bin/usr/bin/install -c rup /usr/local/bin/rup/usr/bin/install -c rsysinfo /usr/local/bin/rsysinfo/bin/sh ./mkinstalldirs /usr/local/sbin/usr/bin/install -c rpc.rstatd /usr/local/sbin/rpc.rstatdmake[1]: Nothing to be done for `install-data-am'.make[1]: Leaving directory `/opt/rpc.rstatd'
2.4.执行:./rpc.rstatd 命令。启动rpc服务。
注:无回显为成功。
[root@localhost rpc.rstatd]# ./rpc.rstatd
2.5.执行:rpcinfo –p 命令。检查rpc服务的状态.[root@localhost rpc.rstatd]# rpcinfo -pprogram vers proto port100000 2 tcp 111 portmapper100000 2 udp 111 portmapper100024 1 udp 797 status100024 1 tcp 800 status100001 5 udp 900 rstatd100001 3 udp 900 rstatd100001 2 udp 900 rstatd100001 1 udp 900 rstatd[root@localhost rpc.rstatd]#
3. 可能会出现的错误:
1,若RPC服务没有成功启动。2,若目标主机上开启了防火墙,阻挡了RPC服务。在LR中添加时可能会出现如下错误:
Monitor name :UNIX Resources. Cannot initialize the monitoring on 10.1.200.65. 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: RPC Server <100001, 3, 17> is not registered on host '10.1.200.65'. (entry point: CFactory::Initialize). [MsgId: MMSG-47190]
Monitor name :UNIX Resources. Internal rpc error (error code:2). Machine: 10.1.200.65. Hint: Check that RPC on this machine is up and running. Check that rstat daemon on this machine is up and running (use rpcinfo utility for this verification). Details: RPC: RPC call failed.RPC-TCP: recv()/recvfrom() failed.RPC-TCP: Timeout reached. (entry point: Factory::CollectData). [MsgId: MMSG-47197]
●作者李龙,山东织雀信息科技有限公司负责人,织雀教育首席讲师,中国民主同盟盟员,北京人文大学云测学院院长、高工,国内软件测试“川模型”的提出者,全国大学生软件测试大赛评审委员会专家,致力于软件测试人才培养
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)