apache+nagios+pnp4nagios(Client 安裝配置)
阿新 • • 發佈:2019-01-28
# tar zxvf nagios-plugins-1.4.16.tar.gz
# cd nagios-plugins-1.4.16
# ./configure --prefix=/usr/local/nagios
# make && make install
修改目錄許可權
# tar zxvf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure
# make all
接下來安裝NPRE外掛,daemon和示例配置檔案。
安裝check_nrpe 這個外掛
# make install-plugin
監控機需要安裝check_nrpe 這個外掛,被監控機並不需要,我們在這裡安裝它只是為了測試目的。
安裝deamon
# make install-daemon
安裝配置檔案
# make install-daemon-config
安裝在監控主機(Nagios-Server)上 指令碼
# make install-xinetd
訪問vi /etc/xinetd.d/nrpe
在only_from 後增加監控主機的IP地址(以空格區分)
如: only_from = 127.0.0.1 192.168.113.150安裝xinetd
yum install -y xinetd
編輯/etc/services檔案,增加NRPE服務
vi /etc/services
增加如下
# Local services
重啟xinetd服務
service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
檢視NRPE是否已經啟動
netstat -at|grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
netstat -an|grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
可以看到5666埠已經在監聽了
5.測試NRPE是否則正常工作
之前我們在安裝了check_nrpe這個外掛用於測試,現在就是用的時候.執行
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
會返回當前NRPE的版本
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.15
也就是在本地用check_nrpe連線nrpe daemon是正常的
注:為了後面工作的順利進行,注意本地防火牆要開啟5666能讓外部的監控機訪問
監控主機(Server端)上配置
安裝check_nrpe 外掛
# tar zxvf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure
# make all
# make install-plugin
只執行這一步就行了,因為只需要check_nrpe外掛