cacti+nagios之nagios的搭建(三)

紫翼龍王夜發表於2015-02-12
本系列文章適合有一定linux基礎的人員使用,如果使用過程中有什麼問題,請與本人聯絡。如需轉載請註明出處。


cd  /root/cactinagios

wget

tar –xf nagios-4.0.7.tar.gz

cd nagios-4.0.7

./configure –with-command-group=nagios  --prefix=/var/www/html/nagios  --enable-event-broker

make all

make install && make install-init  && make install-config 

make  install-commandmode  &&make  install-webconf

設定登入web介面時http驗證的賬號密碼:

htpasswd  -c  /var/www/html/nagios/etc/htpasswd.users nagiosadmin


安裝nagios-plugins

cd  /root/cactinagios

Wget  

tar –xf nagios-plugins-2.0.2.tar.gz

cd  nagios-plugins-2.0.2

./configure –with-nagios-user=nagios –with-nagios-group=nagios –prefix=/var/www/html/nagios –with-mysql

make

mke install

 
附apache的配置說明:
找到apache的配置檔案:/etc/httpd/httpd.conf
找到:



檢查nagios的配置:

/var/www/html/nagios/bin/nagios  -v  /var/www/html/nagios/etc/nagios.cfg

新增自動啟動:     

chkconfig –add  nagios

chkconfig nagios on

service nagios start

登陸頁面:

nagios客戶端的安裝配置:

cd  /yunwei
pssh -h ip.txt     "mkdir /yunwei"  
pscp -h ip.txt      
pssh  -h ip.txt    "./configure  --prefix=/usr/local/nagios"
pssh  -h ip.txt    "make  &&  make install"
pssh  -h ip.txt   "chown     nagios:nagios    /usr/local/nagios" make install-plugin pssh -h ip.txt "wget "
tar -xf  nrpe-2.13.tar.gz
cd nrpe-2.13
./configure
make     all
make  install-plugin
make  install-daemon
make install-daemon-config
make install-xinetd
再次檢視nagios-plugins目錄就會發現有5個目錄了;
cat  /etc/xinetd.d/nrpe
 
注意:only_from增加監控端主機的ip地址;
編輯/etc/services 檔案,增加NRPE服務
 
service  xinetd  restart
可以看到5566埠已經在監聽了;
使用如下命令,測試客戶端是否正常安裝了nrpe外掛
/usr/local/nagios/libexec/check_nrpe -H localhost
在監控端,開啟commands.cfg,編輯新增如下內容:

# 'check_nrpe' command definition
define command{
        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 的時候要用 “!” 帶上這個引數。
 

 
 
 



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30129545/viewspace-1434506/,如需轉載,請註明出處,否則將追究法律責任。

相關文章