閱讀840 返回首頁    go 阿裏雲 go 技術社區[雲棲]


使用nrpe監控管理遠程linux主機

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裏進行定義   

5、在服務器端安裝NRPE和配置nagios服務

   #tar zxvf nrpe-2.12.tar.gz
   #cd nrpe-2.12
   #./configure
   #make all
   #make install-plugin

   #測試:/usr/local/nagios/libexec/check_nrpe -H 客戶端主機地址

   #測試正常返回客戶端主機的nrpe版本信息

6、在服務器commands.cfg文件裏定義一個check_nrpe監控命令

   define command {
    command_name  check_nrpe
    command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ -c $arg1$
   }

7、添加遠程主機監控

   使用新定義的check_nrpe命令

最後更新:2017-11-06 12:33:44

  上一篇:go  批量修改文件名
  下一篇:go  nfs導致ftp無法訪問