见博文
1、配置nagios客户端(即可远程主机)
在nagios客户端安装nagios插件和NRPE
#useradd -s /sbin/nologin nagios
#tar zxvf nagios-plugins-1.4.15.tar.gz
#cd nagios-plugins-1.4.15
#./configure
#make && make install
#chown nagios.nagios /usr/local/nagios
#chown -R nagios.nagios /usr/local/nagios/libexec
#tar zxvf nrpe-2.12.tar.gz
#cd nrpe-2.12
#./configure
#make all
#make install-plugin
#make install-daemon
#make install-daemon-config
2、配置NRPE
配置文件:/usr/local/nagios/etc/nrpe.conf
在allowed_hosts=127.0.0.1 后加上nagios服务器的ip地址或者域名,用逗号分隔
3、启动NRPE
#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
#可将此命令写入rc.local文件,以便可以开机启动
#验证:#netstat 0antl | grep 5666
#测试:#/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
正常情况下会返回版本信息
4、定义监控服务的内容
在/usr/local/nagios/etc/nrpe.conf里进行定义
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
测试:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_ips