tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --prefix=/usr/local/nagios
make all
make install-plugin
(3)在被监控主机上的安装
groupadd nagios
useradd -g nagios -d /usr/local/nagios -s /sbin/nologin nagios
1)被监控机安装plugin
tar zxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/usr/local/nagios --with-ping-command="/bin/ping"
make
make install
#查看播件文件是否已安装在这个目录
ls /usr/local/nagios/libexec
2)被监控机安装NRPE
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
chown -R nagios:nagios /usr/local/nagios
2. NRPE的配置 NRPE的配置也是分为两部分:在监控主机上的配置和被监控主机上的配置,具体如下:
(1)在被监控主机上的配置
附注:
如果nagios的监控服务出现“Connection refused or timed out”的错误信息,需要进行以下检查和修复工作: 在被监控主机上操作:
检查nrpe.cfg中allowed_hosts是否包含监控机ip地址
检查/etc/hosts.allow文件中监控机ip地址nrpe:192.168.1.91
检查iptables
开放5666端口
iptables -L
iptables -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 5666 -j ACCEPT
#注意顺序
iptables -L
service iptables save
service iptables restart