您好,登錄后才能下訂單哦!
一、安裝nagios前的準備工作
1.解決安裝Nagios的依賴關系:Nagios基本組件的運行依賴于httpd、gcc和gd
2. 所需要安裝組件:
服務端所用的安裝包為 nagios nagios-plugins
linux客戶端 nrpe
windows客戶端 NSClient++
二.下載需求軟件
nagios主程序:wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
nagios插件程序:wget http://down1.chinaunix.net/distfiles/nagios-plugins-1.4.13.tar.gz
apache程序:wget http://autosetup1.googlecode.com/files/httpd-2.2.11.tar.gz
php程序:wget http://museum.php.net/php5/php-5.3.0.tar.gz
三.編譯安裝nagios
1.tar zxf nagios-3.1.2.tar.gz
[root@localhost nagios-3.1.2]# cd nagios-3.1.2
[root@localhost nagios-3.1.2]#./configure --enable-event-broker--prefix=/usr/local/nagios
[root@localhost nagios-3.1.2]#make all
[root@localhost nagios-3.1.2]#make install
[root@localhost nagios-3.1.2]#make install-init
[root@localhost nagios-3.1.2]#make install-config
[root@localhost nagios-3.1.2]#make install-commandmode
在httpd的配置文件目錄(conf.d)中創建Nagios的Web程序配置文件:
[root@localhost nagios-3.1.2]# make install-webconf
創建一個登錄nagiosweb程序的用戶,這個用戶帳號在以后通過web登錄nagios認證時所用:
# htpasswd -c/var/www/nagios/etc/htpasswd.users nagiosadmin
2.編譯安裝nagios-plugins
nagios的所有監控工作都是通過插件完成的,因此,在啟動nagios之前還需要為其安裝官方提供的插件。
tar zxf nagios-plugins-1.4.13.tar.gz
[root@localhost nagios-plugins-1.4.13]#cd nagios-plugins-1.4.13
[root@localhost nagios-plugins-1.4.13]#./configure --with-nagios-user=nagios --with-[root@localhost nagios-plugins-1.4.13]#nagios-group=nagios -with-mysql
[root@localhost nagios-plugins-1.4.13]#make
[root@localhost nagios-plugins-1.4.13]#make install
4.配置并啟動Nagios
/etc/init.d/nagios start
注:如果啟動時會報錯
Error: Cannot open main configuration file '/root/nagios-plugins-1.4.13/start' for reading!
Nagios 3.1.2 starting... (PID=14327)
Local time is Fri Feb 28 02:52:22 CST 2014
Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=14327)
使用: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg檢查配置文件沒有發現錯誤
可使用:/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg 嘗試啟動
啟動成功之后 可以使用top命令查看是否有nagios進程(有nagios進程說明啟動成功)
注: service nagios restart 啟動時再次失敗
Running configuration check...done.
Stopping nagios: done.
Starting nagios:su: warning: cannot change directory to /home/nagios: No such file or directory
This account is currently not available.
done.
可以使用: mkdir /home/nagios 解決
service nagios restart 如果啟動時仍然失敗 但錯誤提示是:
Running configuration check...done.
Stopping nagios: done.
Starting nagios:This account is currently not available.
done.
可以在:vi /etc/passwd
找到此行:nagios:x:500:500::/home/nagios:/sbin/nologin(注意紅色字體),把此行改成如下一行
nagios:x:500:500::/home/nagios:/bin/bash
修改后再次重啟 ,啟動成功
[root@localhost nagios-3.1.2]# service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。