天天看點

nagios 版本更新

一、從舊的3.x版本更新到目前版本

1、備份現有版本的nagios軟體和配置檔案,防止更新過程中出現問題可以回退到原先版本;

2、切換到nagios使用者,當然也可以使用root使用者;

3、下載下傳最新版本的nagios安裝包(http://www.nagios.org/download/)

4、展開解壓新版本的nagios安裝包

#tar zxf nagios-3.x.tar.gz

#cd nagios

5、運作nagios源程式的配置腳本并加入外部指令的組名

#./configure --with-command-group=nagcmd

6、編譯源程式并安裝

#make all && make install

7、驗證配置并重新開機nagios

#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

#service nagios restart

二、從舊的2.x版本更新到3.x版本

1、先備份2.x舊版本nagios軟體和配置檔案,防止更新過程中出現問題可以回退到原先版本;

7、驗證配置

出現2個warning和1個critical

2個warning為:downtime_file和comment_file這兩個檔案已經不再使用,将它們的内容添加到state_retention_file這個檔案的後面;

1個critical為:434行有錯誤,變量不能識别;

2個warning的處理方法:

将nagios.cfg中的comments和downtime變量注釋掉

#comment_file=/usr/local/nagios/var/comments.dat

#downtime_file=/usr/local/nagios/var/downtime.dat

找到state_retention_file=/usr/local/nagios/var/retention.dat

然後執行如下指令:

#cd /usr/local/nagios/var #確定與上述state_retention_file路徑一緻;

#cat comments.dat >>retention.dat

#cat downtime.dat >>retention.dat

1個critical的處理方法:

注釋掉434行

#check_result_buffer_slots=4096 #該變量已不再使用

重新驗證并重新開機動nagios正常;

注意:nagios2.x更新到nagios3.x版本其相應的NDoutils元件也要比對更新後的nagios版本;

下面說一下ndoutils更新方法:

1、cd /usr/local/nagios/bin #備份原先版本相關檔案

cp ndo2db ndo2db_2.x

cp ndomod. o ndomod.o_2.x

2、下載下傳最新版本ndoutils元件并解壓縮執行如下指令:

#./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql --with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql

# make

# cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db

# cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o

3、重新開機ndo

#/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

4、重新開機nagios

5、檢視nagios日志(/usr/local/nagios/var/nagios.log下),出現如下内容說明正常;

ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors

ndomod: Successfully connected to data sink. 0 queued items to flush.

Event broker module '/var/www/html/nagios/bin/ndomod-3x.o' initialized successfully.

三、從RPM包安裝狀态更新

1、備份先前用RPM包或APT軟體包安裝的nagios軟體及相應的配置檔案;

nagios.cfg #主配置檔案

resource.cfg #資源配置檔案

cgi.cfg #CGI配置檔案

retention.cfg #保留檔案

nagios事件日志檔案 #nagios.log

2、解除安裝先前已經安裝過的RPM包或APT包

3、利用源碼包進行nagios的安裝,在此步驟省略。

4、将先前備份的nagios的配置檔案,保留檔案及日志檔案替換到到目前新版本nagios的相應目錄下;

5、重新驗證和重新開機nagios

繼續閱讀