一、Nagios監控主機配置(IP:192.168.7.249)
1、安裝nrpe服務
解壓縮
[root@nagios ~]# tar -zxvf nrpe-2.14.tar.gz
[root@nagios ~]# cd nrpe-2.14
編譯
[[root@nagios nrpe-2.14]#./configure
root@nagios nrpe-2.14]# make all
[root@nagios nrpe-2.14]# make install-plugin
只運行這一步就行了,因為只需要check_nrpe外掛程式
2、編輯commands.cfg檔案定義nrpe對的使用
[root@nagios ~]# vim /usr/local/nagios/etc/objects/commands.cfg
在最後面增加如下內容:
# 'check_nrpe ' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
說明:
command_name check_nrpe
定義命令名稱為check_nrpe,在services.cfg中要使用這個名稱.
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
這是定義實際啟動並執行外掛程式程式.這個命令列的書寫要完全按照check_nrpe這個命令的用法.不知道用法的就用check_nrpe –h查看
-c後面帶的$ARG1$參數是傳給nrpe daemon執行的檢測命令,之前說過了它必須是nrpe.cfg中所定義的那5條命令中的其中一條.在services.cfg中使用check_nrpe的時候要用!帶上這個參數
3、配置監控對象(工作站及其服務等)
[root@nagios ~]# vim /usr/local/nagios/etc/nagios.cfg
在cfg_file=/usr/local/nagios/etc/objects/localhost.cfg下添加:
cfg_file=/usr/local/nagios/etc/objects/services.cfg