NagiosQL是專為nagios設計的web圖形化管理應用,主要作用就是操作資料庫和設定檔,其中包括將設定檔的資訊寫到資料庫中,在資料庫中修改Nagios的監控配置資訊,並將資料庫中存放的配置更新到檔案中。使用者可以通過NagiosQL提供的Web頁面直觀的修改配置。實現架構很簡單,功能很實用。
Nagiosql功能介紹:
1、 具有基本的nagios的組態管理能力,匯入,匯出設定檔的功能
2、 具有nagios設定檔檢查、排錯的能力
3、 Nagiosql可對檔案結構進行定製,可延續之前的配置結構,按IP組建組態
4、 Nagiosql將每一次配置的變更做一次配置備份,以時間戳記為尾碼儲存,理論上可以復原到任意一個曆史配置
環境:
Linux CentOS 6.0 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
軟體版本:
nagiosql_311.tar.gz
nagios-3.3.1.tar.gz
nagios-plugins-1.4.15.tar.gz
備忘:預設已經關閉selinux
一、LAMP環境搭建
1、 安裝lamp所需要的軟體包
[root@centos6 ~]# yum install make gcc gcc-c++ zlib-devel libaio -y
2、 安裝lamp環境
[root@centos6 ~]# yum install -y httpd php php-mysql mysql mysql-server php-snmp php-pdo perl-DBD-MYSQL
3、 啟動httpd和mysql
[root@centos6 ~]# service httpd restart
[root@centos6 ~]# service mysqld restart
4、 設定apache、mysql、php開機啟動
[root@centos6 ~]# chkconfig --add httpd
[root@centos6 ~]# chkconfig httpd on
[root@centos6 ~]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos6 ~]# chkconfig --add mysqld
[root@centos6 ~]# chkconfig mysqld on
[root@centos6 ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
5、 測試lamp環境是否安裝成功(OK)
二、Nagios搭建
1、環境說明
Nagiosql根位置:/usr/local/nagiosql
Nagiosql設定檔位置:/usr/local/nagiosql/etc
Nagiosql的使用者和使用者組:nagiosql|nagiosql
Apache的啟動使用者和組:apache|apache
2、安裝nagios的依賴軟體包
[root@centos6 ~]# yum install -y gcc glibc glibc-common gd gd-devel
3、建立nagios帳號
[root@centos6 ~]# useradd nagios
[root@centos6 ~]# passwd nagios
[root@centos6 ~]# groupadd nagios
[root@centos6 ~]# usermod -G nagios nagios
4、安裝nagios
[root@centos6 ~]# tar -zxvf nagios-3.3.1.tar.gz
[root@centos6 nagios]# ./configure --prefix=/usr/local/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios
[root@centos6 nagios]# make all
[root@centos6 nagios]# make install
[root@centos6 nagios]# make install-init
[root@centos6 nagios]# make install-config
[root@centos6 nagios]# make install-commandmode
[root@centos6 nagios]# make install-webconf
5、配置web介面,建立一個使用者(以及密碼)用於nagios的web介面登入
[root@centos6 nagios]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
重啟apache使設定生效
[root@centos6 nagios]# service httpd restart
6、 編譯安裝nagios官方外掛程式
[root@centos6 ~]# tar -zxvf nagios-plugins-1.4.15.tar.gz
[root@centos6 ~]# cd ./nagios-plugins-1.4.15
[root@centos6 nagios-plugins-1.4.15]#
./configure --prefix=/usr/local/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios
[root@centos6 nagios-plugins-1.4.15]# make && make install
驗證外掛程式是否安裝成功(該目錄下有外掛程式檔案即可)
[root@centos6 nagios-plugins-1.4.15]# ls /usr/local/nagios/libexec/
7、 啟動nagios並設定開機啟動
[root@centos6 nagios-plugins-1.4.15]# chkconfig --add nagios
[root@centos6 nagios-plugins-1.4.15]# service nagios restart
8、 Web測試(成功登入)