建立 nagios使用者
useradd nagios
tar xzvfnagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure
make
make install
tar xzvf nrpe-2.1.2.tar.gz
cd nrpe-2.1.2
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
檢查插件安裝
ll /usr/local/nagios/libexec/
#vi/usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.169.0.201
啟動nrpe
#/usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg –d
# netstat -plnt |grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 16831/nrpe
echo'/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d'>>/etc/rc.local
[root@nagios-server src]#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.100
NRPE v2.12
若出現版本号,代表nrpe用戶端安裝成功。
#vi /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users-w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load-w 15,10,5 -c 30,25,20
#vi /usr/local/nagios/etc/objects/hosts.cfg
define host{
use linux-server,host-pnp
host_name hostb
alias hostb
address 192.168.1.100
}
#vi /usr/local/nagios/etc/objects/services.cfg
define service{
use generic-service,srv-pnp
host_name hostb
service_description check_users
check_command check_nrpe!check_users
max_check_attempts 5
normal_check_interval 1
}
service_description check_load
check_command check_nrpe!check_load
#/etc/init.d/nagios checkconfig
#/etc/init.d/nagios restart
<a href="http://s3.51cto.com/wyfs02/M01/26/8F/wKioL1NrZOPBCgaaAABkYNrkfiQ950.jpg" target="_blank"></a>
本文轉自楊雲1028 51CTO部落格,原文連結:http://blog.51cto.com/yangrong/1408526,如需轉載請自行聯系原作者