服务端(192.168.2.110)无法访问客户端的NRPE:
[[email protected] ~]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.12
[[email protected] ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.2.120
Connection refused by host
客户端(192.168.2.120):
[[email protected] etc]# lsof -i :5666
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nrpe 18703 nagios 4u IPv4 85766 0t0 TCP localhost:5666 (LISTEN)#只在本地有效,所有外部的IP无法访问
[[email protected] etc]# vim nrpe.conf +44
将以下内容注释掉:
#server_address=127.0.0.1
[[email protected] etc]# pkill nrpe
[[email protected] etc]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
[[email protected] etc]# lsof -i :5666
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nrpe 18766 nagios 4u IPv4 89670 0t0 TCP *:5666 (LISTEN)
这个就可以正常访问了
服务端访问:
[[email protected] etc]# /usr/local/nagios/libexec/check_nrpe -H 192.168.2.120 -c check_iostat
IOSTAT OK - user 0.28 nice 0.00 sys 0.30 iowait 0.31 idle 0.00 | iowait=0.31%;; idle=0.00%;; user=0.28%;; nice=0.00%;; sys=0.30%;;