1、下载nrpe2.15

  wget http://cznic.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

2、yum install openssl openssl-devel

   cd nrpe-2.15

   ./configure --enable-ssl --with-nagios-user=nagios --with-nagios-group=nagcmd --with-nrpe-user=nagios --with-nrpe-group=nagcmd

   make all

   make install-plugin

   make install-daemon

   make install-daemon-config

   make install-xinetd

3、编辑nrpe配置文件,增加监控机地址:   

      vi /etc/xinetd.d/nrpe

      only_from = nagios-server-ip,127.0.0.1

4、编辑vi /usr/local/nagios/etc/nrpe.cfg

      allowed_hosts=nagios-server-ip,127.0.0.1

5、修改services文件,增加端口
          vi /etc/services
          nrpe            5666/tcp                        #NRPE

6、启动 nrpe

   /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

   设置开机启动

   vi /etc/rc.d/rc.local加入/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

   验证是否启动

   netstat -an |grep 5666  

   tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN    

7、报错

   1)NRPE: Command 'check_hda1' not defined

   解决方法:

   nagios主机与被监控linux同时修改:vi /usr/local/nagios/etc/nrpe.cfg

     将command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1

    修改为  command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1

    注意 sda1为需要监控的分区

   2)NRPE: Command 'check_swap' not defined

   解决方法:

   nagios主机与被监控linux同时修改:vi /usr/local/nagios/etc/nrpe.cfg

   增加command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%

8、参考内容http://chenxy.blog.51cto.com/729966/175893/