nagiosql320的安裝及中文界面的問題
1.下載nagiosql320及補丁
2.解壓並複製到相應目錄
tar jxvf nagiosql_320.tar.bz2 unzip nagiosql_320_service_pack_2_additional_fixes_only.zip \cp -rf NagiosQL_3.2.0_SP2/* nagiosql32/ mv nagiosql32 /var/www/html/ cd /var/www/html/ chown -R apache.apache nagiosql32/ mkdir -pv /etc/nagiosql/{hosts,services,backup/{hosts,services}} mkdir -pv /etc/nagios/ chown -R apache.apache /etc/nagiosql/ chown -R apache.apache /etc/nagios/
4.配置虛擬主機
cd /etc/httpd/conf.d/ vi nagiosql.conf Alias /nagiosql "/var/www/html/nagiosql32" <Directory "/var/www/html/nagiosql32"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
5. 重啓httpd:
service httpd configtest service httpd restart
6.安裝ssh2
yum -y install php-devel libssh2 libssh2-devel wget http://pecl.php.net/get/ssh2-0.12.tgz tar zxf ssh2-0.12.tgz cd ssh2-0.12 phpize ./configure make && make install vi /etc/php.d/ssh2.ini extension=ssh2.so
7.創建數據庫並導入
mysql -uroot -p -e "create database db_nagiosql_v3;grant all on db_nagiosql_v3.* to nagiosql identified by 'nagiosql'"
update user set password=password('yourootpass') where user='root';//更新root帳號密碼,如果沒有設置的話
8.目錄授權
chmod -R 777 /var/www/html/nagiosql32/config
9.訪問web頁面並進行安裝
http://localhost/nagiosql/install/install.php
會出現下面這樣的提示,無需理會,選“NEXT”
Settings file does not exist (config/settings.php): will be created
Database name * db_nagiosql_v3 //填寫剛纔創建的數據庫名稱
NagiosQL DB User * nagiosql //填寫剛纔創建好的數據庫用戶
NagiosQL DB Password * nagiosql //填寫剛纔創建好的數據庫用戶密碼
Administrative Database User * root //填數據庫管理員帳號
Administrative Database Password * ****** //填寫數據庫管理員帳號密碼
Drop database if already exists? //勾選
Initial NagiosQL User * //nagiosql web登錄帳號,默認爲admin
Initial NagiosQL Password * //設置對應帳號的密碼
Please repeat the password * //確認設置密碼
Import Nagios sample config? //導入示例配置
Create NagiosQL config paths? //創建配置文件路徑,勾選
10.nagiosql的配置,參照下圖
11.修改界面爲中文
12.nagios配置:註釋掉原有的cfg_dir和cfg_file,添加如下代碼
cfg_dir=/etc/nagiosql/hosts cfg_dir=/etc/nagiosql/services cfg_file=/etc/nagiosql/contacttemplates.cfg cfg_file=/etc/nagiosql/hostgroups.cfg cfg_file=/etc/nagiosql/serviceescalations.cfg cfg_file=/etc/nagiosql/servicetemplates.cfg cfg_file=/etc/nagiosql/commands.cfg cfg_file=/etc/nagiosql/hostdependencies.cfg cfg_file=/etc/nagiosql/serviceextinfo.cfg cfg_file=/etc/nagiosql/timeperiods.cfg cfg_file=/etc/nagiosql/contactgroups.cfg cfg_file=/etc/nagiosql/hostescalations.cfg cfg_file=/etc/nagiosql/hosttemplates.cfg cfg_file=/etc/nagiosql/servicegroups.cfg cfg_file=/etc/nagiosql/contacts.cfg cfg_file=/etc/nagiosql/hostextinfo.cfg cfg_file=/etc/nagiosql/servicedependencies.cfg
13.nagios控制:依次檢查配置並重啓nagios
14.中文界面問題:
發現修改後菜單欄依然不能漢化,而且當點擊菜單欄後語言會恢復到英文,可以手工修改functions目錄下的prepend_adm.php,具體如下:
編輯文件;vi functions/prepend_adm.php,修改 $strStoreLanguage = $_SESSION['SETS']['data']['locale']爲 $strStoreLanguage = "zh_CN",修改後的效果如下所示:
if (isset($_SESSION['SETS']['data']['locale']) && ($_SESSION['SETS']['data']['locale'] != "")) $strStoreLanguage = "zh_CN";