您好,登錄后才能下訂單哦!
監控系統是運維人員的一個重要工具,熟悉其的構建與應用必不可少。nagios與centreon的搭
配是開源軟件最佳選擇。現在將我的構建與應用過程記錄如下。
一.環境預安裝
1.獲取主軟件包
wget http://jaist.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.5.0/nagios-3.5.0.tar.gz wget http://download.centreon.com/centreon/centreon-2.4.2.tar.gz wget http://nchc.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz wget http://nchc.dl.sourceforge.net/project/nagios/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.5.2_light.patch wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz |
2.安裝第三方源
[root@localhost ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-1.el6.rf.i686.rpm [root@localhost ~]#rpm -ivh rpmforge-release-0.5.2-1.el6.rf.i686.rpm |
如果不安裝第三方源會導致相關軟件包不能安裝,進而導致主安裝出現相關問題。
3.安裝相關軟件包
安裝apache [root@localhost ~]# yum -y install httpd [root@localhost ~]# yum install mysql-devel openssl-devel mysql-server 在/etc/my.conf中的[mysqld]加入 innodb_file_per_table=1 否則在web安裝第七步時會有提示。 安裝php RRDTools 安裝perl 安裝SNMP
|
二. 主軟件包安裝
nagios主要監控系統與網絡信息,同時監控遠程與本地主機及相關服務,還提供信息異常功能
1.安裝nagios
添加相關用戶及組 [root@localhost ~]# useradd -m nagios 安裝nagios [root@localhost monitor]# tar -zxvf nagios-3.5.0.tar.gz |
nagios如果少了其插件,將什么也做不了,其功能主要通過插件來完成的。
2.nagios-pluigns安裝
[root@localhost monitor]# tar -zxvf nagios-plugins-1.4.16.tar.gz |
3.ndoutils安裝
ndoutils主要將相關數據存儲到數據庫,ndoutils非常重要。
[root@localhost ndoutils-1.5.2]# tar -zxvf ndoutils-1.5.2.tar.gz [root@localhost ndoutils-1.5.2]# patch -p1 -N < ndoutils1.5.2_light.patch [root@localhost ndoutils-1.5.2]# ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios [root@localhost ndoutils-1.5.2]# make && make install [root@localhost ndoutils-1.5.2]# cp daemon-init /etc/init.d/ndo2db [root@localhost ndoutils-1.5.2]# chmod 755 /etc/init.d/ndo2db [root@localhost ndoutils-1.5.2]# cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg [root@localhost ndoutils-1.5.2]# /etc/init.d/ndoutils start |
4.centreon安裝
centreon以web方式展現給用戶,通過第三方軟件實現對網絡,應用程序,主機的監控。
注:如下安裝過程只做參考,其不是第一次安裝 ,與第一次安裝可能有所不同,第一次安裝時會更新相關模塊。
文本安裝
[root@localhost monitor]# tar -zxvf centreon-2.4.2.tar.gz
You will now read Centreon Licence. Do you want to install : Centreon Web Front Do you want to install : Centreon CentCore Do you want to install : Centreon Nagios Plugins Do you want to install : Centreon Snmp Traps process ------------------------------------------------------------------------ Where is your Centreon directory? Do you want me to create this directory ? [/usr/local/centreon] Where is your Centreon log directory Do you want me to create this directory ? [/usr/local/centreon/log] Where is your Centreon etc directory Do you want me to create this directory ? [/usr/local/centreon/etc] Where is your Centreon binaries directory Do you want me to create this directory ? [/usr/local/centreon/bin] Where is your Centreon data informations directory Do you want me to create this directory ? [/usr/local/centreon/data] Where is your Centreon generation_files directory? Where is your Centreon variable library directory? Do you want me to create this directory ? [/usr/local/centreon/var/lib] Where is your CentPlugins Traps binary Where is the RRD perl module installed [RRDs.pm] Where is PEAR [PEAR.php] What is the Centreon group ? [centreon] What is the Centreon user ? [centreon] What is the Monitoring engine user ? What is the Broker user ? (optional) What is the Monitoring engine log directory ? Where is your monitoring plugins (libexec) directory ? ------------------------------------------------------------------------ Where is sudo configuration file What is the Monitoring engine init.d script ? What is the Monitoring engine binary ? What is the Monitoring engine configuration directory ? Where is the configuration directory for broker module ? Where is the init script for broker module daemon ? Do you want me to reconfigure your sudo ? (WARNING) ------------------------------------------------------------------------ Do you want to update Centreon Apache sub configuration file ? Do you want to reload your Apache ? ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ Where is your Centreon Run Dir directory? Do you want me to create this directory ? [/usr/local/centreon/var/run] Where is your CentStorage binary directory Where is your CentStorage RRD directory Do you want me to install CentStorage init script ? Do you want me to install CentStorage run level ? ------------------------------------------------------------------------ Where is your CentCore binary directory Do you want me to install CentCore run level ? ------------------------------------------------------------------------ Where is your CentPlugins lib directory Do you want me to create this directory ? [/usr/local/centreon/var/lib/centplugins/] ------------------------------------------------------------------------ Where is your SNMP configuration directory Where is your SNMPTT binaries directory |
web安裝
(1)centreon的歡迎界面
(2)檢查依賴關系
(3)配置nagios信息
(4)配置ndoutils模塊
(5)配置admin用戶
(6)配置數據庫信息
(7)安裝
(8)安裝完成
5.服務器端nrpe安裝
nrpe是nagios組件,能夠執行遠程主機的本地檢測腳本,監控運行狀態。
[root@localhost monitor]# tar -zxvf nrpe-2.14.tar.gz [root@localhost nrpe-2.14]# ./configure [root@localhost nrpe-2.14]# make all && make install |
服務器端檢測錯誤
[root@nodes01 nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 CHECK_NRPE: Error - Could not complete SSL handshake |
在/usr/local/nagios/etc/nrpe.cfg加入
allowed_hosts=127.0.0.1,192.168.4.213 |
[root@nodes01 nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 NRPE v2.12 [root@nodes01 nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H 192.168.4.213 NRPE v2.12 |
三.后續登錄錯誤
1.錯誤信息
2.日志信息
25/4/2013 18:36:01 - 25/4/2013 18:36:1 - DBI connect('database=centreon_storage;host=localhost:3306','centreon',...) failed: Access denied for user 'centreon'@'localhost' to database 'centreon_storage' at /usr/local/centreon/bin/logAnalyser line 596 |
3.解決方法
mysql> grant all on centreon.* to centreon@localhost identified by '123456'; Query OK, 0 rows affected (0.07 sec) mysql> grant all on centreon_status.* to centreon@localhost identified by '123456'; mysql> grant all on centreon_storage.* to centreon@localhost identified by '123456'; mysql> flush privileges; |
成功頁面如下
四.檢查重新生成配置文件
(1)檢查main.cfg的配置
(2)檢查ndo2db.cfg的配置
(3)檢查ndomod.cfg的配置
(4)生成nagios配置文件
web頁面重啟完成后,查看nagios相關日志
[root@localhost ~]# tail -f /usr/local/nagios/var/nagios.log | grep ndomod [1366898324] ndomod: Successfully connected to data sink. 122 queued items to flush. [1366898324] ndomod: Successfully flushed 122 queued items to data sink. |
如果有以上信息代表成功,因為ndoutils是nagios與centreon的紐帶,必須保證其正常運行。
centreon的服務器端已經配置完成,對于其被監控主機上也安裝nagios-plugins和nrpe軟件包,這里就不再重復,centreon的應用配置及漢化后續再出。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。