nagios客戶端之nrpe3.2.1安裝
1、刪除dpkg安裝的nrpe
dpkg -l | grep nrpe
dkpg -P nagios-nrpe-server
2、ubuntu下nrpe3.2.1安裝
下載nrpe3.2.1的源碼包:https://jaist.dl.sourceforge.net/project/nagios/nrpe-3.x/nrpe-3.2.1.tar.gz
在客戶端運行nrpe時需要nagios插件的支持,我下載的是nagios-plugins-2.1.2.tar.gz
https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz#_ga=2.34825377.148967917.1508120974-2090824792.1508120974
3、編譯安裝前先檢查有沒有安裝libssl-dev xinetd openssl-devel等等相關包,如沒有安裝,請安裝。
例:
apt-get install libssl-dev
4、創建nagios用戶及用戶組
useradd -s /sbin/nologin nagios
5、解壓下載的nagios插件
tar zxvf nagios-plugins-2.1.2.tar.gz
cd nagios-plugins-2.1.2
6、編譯安裝插件(默認安裝路徑在/usr/local/nagios,如不存在會自動創建)
./configure
make && make install
7、解壓下載的nrpe 3.2.1源碼包
tar zxvf nrpe-3.2.1.tar.gz
8、編譯安裝
cd nrpe-3.2.1
./configure
make all
make install
9、安裝check_nrpe插件:
make install-plugin
10、安裝daemon
make install-daemon
nrpe daemon會運行相應的nagios插件來檢查信息,並將信息返回給check_nrpe插件然後交給nagios處理
安裝配置文件:
nrpe3.0之前版本執行make install-daemon-config,
nrpe3.0以上版本下執行此命令時會提示沒有這個參數
[root@localhost nrpe-3.2.1]# make install-daemon-config
make: *** No rule to make target `install-daemon-config‘. Stop.
在nrpe3.2.1版本下需要執行
[root@localhost nrpe-3.2.1]# make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 644 -o nagios -g nagios sample-config/nrpe.cfg /usr/local/nagios/etc
這時可以看到安裝時修改了etc目錄的權限,把配置文件復制到了etc目錄下
11、安裝起動文件:
make install-inetd #install the startup files for inetd, launchd, etc.";\
make install-init #install the startup files for init, systemd, etc
12、修改配置文件(該配置文件中寫入nagios服務端以及需要寫入調用監控的腳本命令,監控的腳本都放在libexec下):
vim /usr/local/nagios/etc/nrpe.cfg
在配置文件中找到
allowed_hosts=127.0.0.1
這行表示允許本地訪問。這裏是客戶端,需要允許服務器端訪問,我們需要在這行下面再添加一行
allowed_hosts=10.0.1.210
設置nagios服務器的的ip。
啟動服務
service start nrpe
設置開機啟動
service enable nrpe
使用check_nrpe插件進行測試,我們按裝的check_nrpe及其它nagios插件都安裝在/usr/local/nagios/libexec目錄下,進入此目錄執行
[root@localhost libexec]# ./check_nrpe -H 127.0.0.1
NRPE v3.2.1
可以參考相關博客:
http://www.cnblogs.com/cornell/p/3818558.html
http://blog.itpub.net/29569333/viewspace-1154196/
http://comic945.lofter.com/post/1ead6bdb_e5ce67f
http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html
http://www.cnblogs.com/ilanni/p/4366232.html
nagios客戶端之nrpe3.2.1安裝