Cents下Nagios的安裝-Nagios主程序的安裝
Nagios主程序的安裝:
1.解壓縮Nagios主程序源代碼包
- [root@KCentOS5C ~]# tar -zxvf nagios-2.9.tar.gz
2.進入Nagios主程序包的解壓目錄
- [root@KCentOS5C ~]# cd nagios-2.9
3.預配置Nagios主程序的環境以及指定安裝路徑
- [root@KCentOS5C nagios-2.9]# ./configure --prefix=/usr/local/nagios
預配置成功后將返回配置環境信息
----------------------------------------------------
- *** Configuration summary for nagios 2.9 04-10-2007 ***:
- General Options:
-------------------------
- Nagios executable: nagios
- Nagios user/group: nagios,nagios
- Command user/group: nagios,nagios
- Embedded Perl: no
- Event Broker: yes
- Install ${prefix}: /usr/local/nagios
- Lock file: ${prefix}/var/nagios.lock
- Init directory: /etc/rc.d/init.d
- Host OS: linux-gnu
- Web Interface Options:
------------------------
- HTML URL: http://localhost/nagios/
- CGI URL: http://localhost/nagios/cgi-bin/
- Traceroute (used by WAP): /bin/traceroute
- Review the options above for accuracy. If they look okay,
- type 'make all' to compile the main program and CGIs.
請注意看最后的提示,如果對以上反饋信息接受的話,則需要繼續執行“make all”命令來編譯主程序以及CGI。
-----------------------------------------------------
4.編譯Nagios主程序
- [root@KCentOS5C nagios-2.9]# make all
Nagios主程序編譯成功后OK
如果在編譯當中沒有發生錯誤的話,那么可以照以下這些命令繼續操作。
- make install
- - This installs the main program, CGIs, and HTML files
執行“make install”命令來對主程序,CGI以及HTML網頁進行安裝。
- make install-init
- - This installs the init script in /etc/rc.d/init.d
執行“install-init”命令來在/etc/rc.d/init.d/目錄中安裝啟動腳本。
- make install-commandmode
- - This installs and configures permissions on the
- directory for holding the external command file
執行“install-commandmode”命令來安裝和配置外部命令對Nagios主路徑操作的權限。(這里所謂的外部命令主要是指Apache服務通過CGI來對Nagios的進行的操作。用戶將通過Web以執行CGI程序腳本的方式來對Nagios的檢測結果進行讀取和調用。)
- make install-config
- - This installs *SAMPLE* config files in /usr/local/nagios/etc
- You'll have to modify these sample files before you can
- use Nagios. Read the HTML documentation for more info
- on doing this. Pay particular attention to the docs on
- object configuration files, as they determine what/how
- things get monitored!
執行“make install-config”命令將會在/usr/local/etc/這個Nagios編譯安裝的主配置路徑下安裝示例配置模板,這將對于之后的配置制定幫助很大。
-----------------------------------------------------
5.安裝Nagios主程序、CGI以及網頁
- [root@KCentOS5C nagios-2.9]# make install
安裝完Nagios主程序、CGI和網頁的之后將提示安裝成功信息以及剩余可操作的步驟
-----------------------------------------------------
6.安裝Nagios的系統啟動腳本
- [root@KCentOS5C nagios-2.9]# make install-init
安裝完Nagios的系統啟動腳本之后將提示腳本安裝成功信息以及剩余可操作的步驟
-----------------------------------------------------
7.將Nagios的啟動腳本添加到系統服務當中去
- [root@KCentOS5C ~]# chkconfig --add nagios
8.將Nagios服務加入到系統啟動服務當中去
- [root@KCentOS5C ~]# chkconfig nagios on
9.安裝和配置外部命令對Nagios主路徑的操作權限
- [root@KCentOS5C nagios-2.9]# make install-commandmode
安裝配置外操作權限后將提示配置成功信息以及剩余可操作步驟
-----------------------------------------------------
10.將Apache服務宿主用戶加到nagios組里面
這樣做是為了讓Apache有適當的權限能夠通過CGI腳本程序對Nagios進行調用,否則Apache將沒有權限調用Nagios,用戶通過Web將無法訪問Nagios處理的所有信息。
- [root@KCentOS5C nagios-2.9]# usermod -G nagios apache
11.安裝Nagios的配置模板
- [root@KCentOS5C nagios-2.9]# make install-config
安裝完畢Nagios主程序的配置模板后將反饋安裝成功的提示信息。
上一節:Apache服務的安裝 下一節:plugins插件程序
【編輯推薦】