您好,登錄后才能下訂單哦!
Nagios安裝流程(centos 5.5環(huán)境 + nagios-cn-3.2.3.tar.bz2 + )
1、 更新yum源
2、 安裝組件
[root@localhost ~]# yum -y install httpd gettext mysql mysql-server mysql-devel php php-mysql php-pear
[root@localhost ~]# yum -y install gd gd-devel php-gd
安裝nagios時需要加--with-gd-lib=/usr/lib --with-gd-inc=/usr/include
不然不能生成statusmap.cgi 也就不能看狀態(tài)圖了!
3、 增加帳號
[root@localhost nagios-cn-3.2.3]# useradd nagios
[root@localhost nagios-cn-3.2.3]# passwd nagios
nagios
[root@localhost nagios-cn-3.2.3]# usermod -s /sbin/nologin nagios
[root@localhost nagios-cn-3.2.3]# groupadd nagcmd
[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd nagios
[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd apache
4、 解壓nagios-cn文件
[root@localhost nagios-cn-3.2.3]# tar -jxvf nagios-cn-3.2.3.tar.bz2
5、 進(jìn)入解壓文件夾
[root@localhost nagios-cn-3.2.3]#cd nagios-cn-3.2.3
6、 運(yùn)行安裝命令
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
備注:提示錯誤
解決辦法:因為是centos linux,默認(rèn)可以采用yum方式安裝,則采用如下命令安裝gcc編譯器即可:# yum -y install gcc
7、 再次運(yùn)行安裝命令(第6步命令),提示沒有錯誤后運(yùn)行make all 命令然后依次執(zhí)行下面的命令
[root@localhost nagios-cn-3.2.3]#make all install
[root@localhost nagios-cn-3.2.3]#make install-init //安裝啟動腳本到/etc/init.d
[root@localhost nagios-cn-3.2.3]#make install-commandmode
[root@localhost nagios-cn-3.2.3]#make install-config //安裝初始配置文件到/usr/local/nagios
8、 退出nagios文件夾并解壓nagios-plugins并進(jìn)入
[root@localhost nagios-cn-3.2.3]#cd ..
[root@localhost nagios-cn-3.2.3]# tar -zxvf nagios-plugins-1.4.15.tar.gz
[root@localhost nagios-cn-3.2.3]#cd nagios-plugins-1.4.15
9、 執(zhí)行安裝命令
[root@localhost nagios-plugins-1.4.15]#./configure --prefix=/usr/local/nagios-plugins --with-nagios-user=nagios --with-nagios-group=nagios
10、 然后執(zhí)行以下命令
[root@localhost nagios-plugins-1.4.15]# make
[root@localhost nagios-plugins-1.4.15]# make install
11、 安裝完成以后在/usr/local/nagios-plugins 會產(chǎn)生一個 libexec 的目錄,將該目錄全部移動到/usr/local/nagios目錄下即可。
[root@localhost nagios-plugins-1.4.15]#mv /usr/local/nagios-plugins/libexec /usr/local/nagios/
12、 配置Apache:在apache的httpd.conf 文件中加入如下內(nèi)容:
[root@localhost /]# vi /etc/httpd/conf/httpd.conf
###nagios
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
13、 啟動Apache服務(wù)
[root@localhost /]# service httpd restart
14、 設(shè)置報報警郵箱
[root@localhost /]# vi /usr/local/nagios/etc/objects/contacts.cfg
將nagios@localhost改為自己的郵箱(310475629@qq.com),保存并退出。
15、 設(shè)置登陸web密碼
[root@localhost /]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: (nagiosadmin)
Re-type new password: (nagiosadmin)
Adding password for user nagiosadmin
16、 啟動(重啟)相關(guān)服務(wù)(Apache及nagios服務(wù))
[root@localhost /]# service httpd restart
[root@localhost /]# service nagios restart
17、 檢查配置文件是否正確
如果出現(xiàn)如下顯示就說明配置沒問題
Total Warnings: 0
Total Errors: 0
18、 現(xiàn)在就可以http://你的 IP/nagios/訪問 nagios(實(shí)驗IP地址為192.168.1.8),提示正常的界面則nagios安裝成功。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。