lr監控linux之詳解rstatd的安裝-zee
1. 前期準備:
1,把rstatd檔案解壓到要監控的機器上。
2,打開終端,定位到rstatd檔案夾下:檢視檔案夾中的内容如下:
[root@localhost rpc.rstatd]# ls
aclocal.m4 copying makefile.am readme rstat_proc.c rup.1
config.h.in cvs makefile.in rpc.rstatd.8 rstat.x rup.c
configure install missing rstatd.8 rsysinfo.1 stamp-h.in
configure.in install-sh mkinstalldirs rstat_main.c rsysinfo.c
2. 執行如下步驟:
2.1. 執行:./configure 指令
[root@localhost rpc.rstatd]# ./configure
creating cache ./config.cache
checking for a bsd compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${make}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gawk... gawk
checking for gcc... gcc
checking whether the c compiler (gcc ) works... yes
checking whether the c compiler (gcc ) is a cross-compiler... no
checking whether we are using gnu c... yes
checking whether gcc accepts -g... yes
checking whether ln -s works... yes
checking whether make sets ${make}... (cached) yes
checking how to run the c preprocessor... gcc -e
checking for sys/ioctl.h... yes
checking for syslog.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether gcc needs -traditional... no
checking for ansi c header files... yes
checking return type of signal handlers... void
updating cache ./config.cache
creating ./config.status
kcreating makefile
creating config.h
2.2. 執行:make 指令。
[root@localhost rpc.rstatd]# make
rm -f rstat.h
rpcgen -h -o rstat.h rstat.x
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rup.c
rup.c: in function 'ointopoint_v5':
rup.c:256: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer type
rup.c: in function 'ointopoint_v3'?
rup.c:292: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer type
rup.c: in function 'main'?
rup.c:317: warning: return type of 'main'?is not 'int'?rm -f rstat_xdr.c
rpcgen -c -o rstat_xdr.c rstat.x
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rstat_xdr.c
rm -f rstat_clnt.c
rpcgen -l -o rstat_clnt.c rstat.x
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rstat_clnt.c
gcc -g -o2 -o rup rup.o rstat_xdr.o rstat_clnt.o
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rsysinfo.c
rsysinfo.c: in function 'ointopoint_v3'?
rsysinfo.c:136: warning: passing argument 6 of 'client->cl_ops->cl_call'?from incompatible pointer type
rsysinfo.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.o
rm -f rstat_svc.c
rpcgen -m -o rstat_svc.c rstat.x
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rstat_svc.c
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rstat_proc.c
gcc -dhave_config_h -i. -i. -i. -g -o2 -c rstat_main.c
rstat_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 install
make[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.rstatd
make[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 -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 797 status
100024 1 tcp 800 status
100001 5 udp 900 rstatd
100001 3 udp 900 rstatd
100001 2 udp 900 rstatd
100001 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]
至此完畢。
本文出自seven的測試人生公衆号最新内容請見作者的github頁:http://qaseven.github.io/