[nagios监控] 配备nagios监控的nrpe组件-监控私有信息

[nagios监控] 配置nagios监控的nrpe组件-监控私有信息
1> 服务端配置----监控私有信息
      a> 安装nrpe
            wget ftp://192.168.68.254/monitor/nagios/nrpe-2.9.tar.gz
            tar -zxvf nrpe-2.9.tar.gz 
            cd nrpe-2.9
            ./configure && make all && make install
            make install-plugin
   
   b> 定义nrpe
         vim /usr/local/nagios/etc/objects/commands.cfg
            214 # 'check_nrpe' command definition
            215 define command{
            216        command_name  check_nrpe
            217        command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ $ARG1$
            218         }

2> 被监控端配置----监控私有信息
      a> 创建nagios 用户
            useradd  nagios
            groupadd nagcmd
            usermod -G nagcmd  nagios

      b> 编译并安装Nagios插件
            wget ftp://192.168.68.254/monitor/nagios/nagios-plugins-1.4.16.tar.gz
            tar -zxvf nagios-plugins-1.4.16.tar.gz
            cd nagios-plugins-1.4.16
            ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
            make && make install
      
            若报 ssh-version版本错误,执行命令
            yum install openssl openssl-devel -y

      c> 安装nrpe
            wget ftp://192.168.68.254/monitor/nagios/nrpe-2.9.tar.gz
            tar -zxvf nrpe-2.9.tar.gz
            cd nrpe-2.9
            ./configure && make all && make install
            make install-plugin
            make install-daemon
            make install-daemon-config
            make install-xinetd
      
      d> 安装xinetd 并配置
            yum install xinetd -y
            vim /etc/xinetd.d/nrpe 
               15         only_from       = 127.0.0.1 192.168.68.218
   
      e> 定义nrpe 命令
            vim /usr/local/nagios/etc/nrpe.cfg
               72 allowed_hosts=127.0.0.1,192.168.68.218
      
       f> 添加定义端口,并启动
            vim /etc/services
               8697 nrpe            5666/tcp                # NRPE
            service xinetd restart

3> 测试nrpe
     a> 被监控端测试
        cd /usr/local/nagios/libexec/
           ./check_nrpe -H localhost
  b> 服务器端测试,检查配置并重启服务
     cd /usr/local/nagios/libexec/
           ./check_nrpe -H 192.168.68.214
            /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 
           service nagios restart