ubuntu 14.04 nagios4+ndoutils2.0+centreon2.5.4(原創(chuàng))
開發(fā)應(yīng)用centreon是開源的IT監(jiān)控軟件,由法國人于2003年開發(fā),最初名為Oreon,并于2005年正式更名為centreon。centreon作為nagios的分布式監(jiān)控管理平臺,其功能之強(qiáng)大,打造了centreon在IT監(jiān)控方面強(qiáng)勢地位,它的底層使用nagios監(jiān)控軟件,nagios通過ndoutil模塊將監(jiān)控?cái)?shù)據(jù)寫入數(shù)據(jù)庫,centreon讀取該數(shù)據(jù)并即時(shí)的展現(xiàn)監(jiān)控信息,通過centreon可以簡單地管理和配置所有nagios,因此,完全可以使用centreon輕易的搭建企業(yè)級分布式IT基礎(chǔ)運(yùn)維監(jiān)控系統(tǒng)
功能優(yōu)點(diǎn)1、gui方式添加host,支持hosttemplate與servicestemplate,自動建立關(guān)聯(lián)服務(wù),與nagios+cacti相比配置方便簡單。2、支持graphtemplate,添加servcie時(shí)自動添加graph,不必象nagios+cacti監(jiān)控與流量圖設(shè)置2步走。3、host監(jiān)控可以全部采用nrpe方式,不必象nagios+cacti生成流量圖必須使用snmp。4、支持多節(jié)點(diǎn)分布式監(jiān)控,nagios+cacti的分布式監(jiān)控現(xiàn)在想起來都頭痛。5、支持acl權(quán)限管理方式,對用戶權(quán)限限制到菜單項(xiàng),nagios+cacti一個(gè)帳號大家用過時(shí)啦。6、詳細(xì)的日志管理功能,日志搜索過濾都支持7、功能模塊化管理,想要新功能官方?jīng)]有怎么辦,自己寫去。<---以上摘自百度百科-->
簡單介紹一下nagios本身是監(jiān)控工具,配置起來比較麻煩,而且不直觀,nagios在這里作為監(jiān)控引擎存在,ndo2db是nagios和MySQL交互的工具,nagiso通過ndo2db對數(shù)據(jù)庫進(jìn)行讀寫.centreon利用nagios引擎,通過web有好界面配置nagios,來達(dá)到監(jiān)控和報(bào)警,以及利用rrdtool繪制圖表.
安裝依賴包sudo apt-get updatesudo apt-get install build-essential libgd2-xpm-dev apache2-utilssudo apt-get install sudo tofrodos bsd-mailx lsb-release mysql-server libmysqlclient15-dev / apache2 apache2-mpm-PRefork php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd / rrdtool librrds-perl libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl / libdigest-sha1-perl libgd-gd2-perl snmp snmpd libnet-snmp-perl libsnmp-perl
libmysqlclient15-dev 換成libmysqlclient-dev
14.04找不到 libdigest-sha1-perl,原因;https://bugs.launchpad.net/ubuntu/+source/libdigest-sha1-perl/+bug/993648This functionality is already provided by Digest::SHA which is included with perl.
sudo apt-get install snmp-mibs-downloader
安裝nagios
sudo useradd -m nagiossudo passwd nagiossudo groupadd nagcmdsudo usermod -a -G nagios,nagcmd nagiossudo usermod -a -G nagios,nagcmd www-data
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
tar xzf nagios-4.0.8.tar.gzcd nagios-4.0.8sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-brokersudo make allsudo make installsudo make install-initsudo make install-configsudo make install-commandmodesudo make install-webconfsudo make install-exfoliation #后面centreon會用到其中的image
如果報(bào)這個(gè)錯(cuò)誤/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf /usr/bin/install: cannot create regular file ‘/etc/httpd/conf.d/nagios.conf’: No such file or directory Makefile:296: recipe for target 'install-webconf' failed make: *** [install-webconf] Error 1
就執(zhí)行sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/conf.d/nagios.conf
加入開機(jī)啟動sudo update-rc.d -f nagios defaults
安裝nagios-pluginswget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gztar xzf nagios-plugins-2.0.3.tar.gzcd nagios-plugins-2.0.3sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagiossudo makesudo make install
添加nagios賬戶sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
安裝ndoutilsNDOutils軟件主要是用于將數(shù)據(jù)存數(shù)據(jù)庫,然后又可讀取出來,它在nagios與centerton之間接收和發(fā)送數(shù)據(jù)。
wget http://sourceforge.net/projects/nagios/files/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gzsudo tar zxvf ndoutils-2.0.0.tar.gzcd ndoutils-2.0.0sudo ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagiossudo makesudo make install
sudo cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfgsudo cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfgsudo chown nagios:nagios /usr/local/nagios/etc/ndo*sudo chmod 775 /usr/local/nagios/etc/ndo*sudo cp daemon-init /etc/init.d/ndo2dbsudo chmod +x /etc/init.d/ndo2dbsudo update-rc.d ndo2db defaults
sudo vim /usr/local/nagios/etc/nagios.cfgevent_broker_options=-1broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
看到網(wǎng)上很多文章都說要要修改ndo2db.cfg,ndomod.cfg,nagios.cfg文件的參數(shù),其實(shí)是不用修改的,因?yàn)榕渲胏entreon時(shí)還是會覆蓋了之前修改的配置文件的.如果要測試ndo2db和nagios之間是否可以讀寫數(shù)據(jù)的話,是要配置ndo2db.cfg,ndomod.cfg,nagios.cfg這三個(gè)文件的.
sudo /etc/init.d/apache2 restartsudo /etc/init.d/ndo2db startsudo /etc/init.d/nagios start
http://ip/nagios這里一定先測試一下nagios和ndo2db,如果可以查看nagios日志/usr/local/nagios/var/nagios.log如果ndo2db有報(bào)錯(cuò),請自行g(shù)oogle,如果nagios不能通過ndo2db往mysql中寫入數(shù)據(jù)的話,centreon是無法配置的.
安裝centreon
wget wget http://download.centreon.com/centreon/centreon-2.5.4.tar.gzsudo tar zxvf centreon-2.5.4.tar.gzcd centreon-2.5.4sudo ./install.sh -i
注:所有下面的配置,都可以通過文件來修改,目錄為/etc/centreon至少配置了不下5次,各種版本路徑好像是不同的,請認(rèn)真對待......Do you accept GPL license ?[y/n], default to [n]:> y ------------------------------------------------------------------------Please choose what you want to install------------------------------------------------------------------------Do you want to install : Centreon Web Front[y/n], default to [n]:> yDo you want to install : Centreon CentCore[y/n], default to [n]:> yDo you want to install : Centreon Nagios Plugins[y/n], default to [n]:> yDo you want to install : Centreon Snmp Traps process[y/n], default to [n]:> y------------------------------------------------------------------------Start CentWeb Installation------------------------------------------------------------------------Where is your Centreon directory?default to [/usr/local/centreon]> Do you want me to create this directory ? [/usr/local/centreon][y/n], default to [n]:> yPath /usr/local/centreon OKWhere is your Centreon log directorydefault to [/usr/local/centreon/log]> Do you want me to create this directory ? [/usr/local/centreon/log][y/n], default to [n]:> yPath /usr/local/centreon/log OKWhere is your Centreon etc directorydefault to [/etc/centreon]> Do you want me to create this directory ? [/etc/centreon][y/n], default to [n]:> yPath /etc/centreon OKWhere is your Centreon binaries directorydefault to [/usr/local/centreon/bin]> Do you want me to create this directory ? [/usr/local/centreon/bin][y/n], default to [n]:> yPath /usr/local/centreon/bin OKWhere is your Centreon data informations directorydefault to [/usr/local/centreon/data]> Do you want me to create this directory ? [/usr/local/centreon/data][y/n], default to [n]:> yPath /usr/local/centreon/data OKWhere is your Centreon variable library directory?default to [/var/lib/centreon]> Do you want me to create this directory ? [/var/lib/centreon][y/n], default to [n]:> yPath /var/lib/centreon OK/usr/bin/rrdtool OK/usr/bin/mail OK/usr/bin/php OKWhere is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php]> Path /usr/share/php OK/usr/bin/perl OKFinding Apache user : www-dataFinding Apache group : www-dataWhat is the Centreon group ? [centreon]default to [centreon]> What is the Centreon user ? [centreon]default to [centreon]> What is the Monitoring engine user ?> nagiosWhat is the Broker user ? (optional)> nagiosWhat is the Monitoring engine log directory ?> /usr/local/nagios/varWhere is your monitoring plugins (libexec) directory ?default to [/usr/lib/nagios/plugins]> /usr/local/nagios/libexecPath /usr/local/nagios/libexec OKAdd group centreon to user www-data OKAdd group centreon to user nagios OKAdd group nagios to user www-data OKAdd group nagios to user centreon OK------------------------------------------------------------------------Configure Sudo------------------------------------------------------------------------Where is sudo configuration filedefault to [/etc/sudoers]> /etc/sudoers OKWhat is the Monitoring engine init.d script ?> /etc/init.d/nagiosWhat is the Monitoring engine binary ?> /usr/local/nagios/bin/nagiosWhat is the Monitoring engine configuration directory ?> /usr/local/nagios/etc Where is the configuration directory for broker module ?> /usr/local/nagios/etcWhere is the init script for broker module daemon ?> /etc/init.d/ndo2dbYour sudo is not configuredDo you want me to configure your sudo ? (WARNING) [y/n], default to [n]:> yConfiguring Sudo OK------------------------------------------------------------------------Configure Apache server------------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ?[y/n], default to [n]:> yCreate '/etc/apache2/conf.d/centreon.conf' OKConfiguring Apache OKDo you want to reload your Apache ?[y/n], default to [n]:> yReloading Apache service OKPreparing Centreon temporary filesChange right on /usr/local/centreon/log OKChange right on /etc/centreon OKChange macros for insertBaseConf.sql OKChange macros for sql update files OKChange macros for php files OKChange macros for perl binary OKChange right on /usr/local/nagios/etc OKAdd group nagios to user www-data OKAdd group nagios to user nagios OKAdd group centreon to user nagios OKCopy CentWeb in system directoryInstall CentWeb (web front of centreon) OKChange right for install directoryChange right for install directory OKInstall libraries OKWrite right to Smarty Cache OKCopying libinstall OKChange macros for centreon.cron OKInstall Centreon cron.d file OKChange macros for centAcl.php OKChange macros for downtimeManager.php OKInstall cron directory OKChange right for eventReportBuilder OKChange right for dashboardBuilder OKChange macros for centreon.logrotate OKInstall Centreon logrotate.d file OKPrepare centFillTrapDB OKInstall centFillTrapDB OKPrepare centreon_trap_send OKInstall centreon_trap_send OKPrepare centreon_check_perfdata OKInstall centreon_check_perfdata OKPrepare centreonSyncPlugins OKInstall centreonSyncPlugins OKPrepare centreonSyncArchives OKInstall centreonSyncArchives OKInstall generateSqlLite OKInstall changeRrdDsName.pl OKPrepare export-mysql-indexes OKInstall export-mysql-indexes OKPrepare import-mysql-indexes OKInstall import-mysql-indexes OKCentreon Web Perl lib installed OK------------------------------------------------------------------------Pear Modules------------------------------------------------------------------------Check PEAR modulesPEAR 1.4.9 1.9.5 OKDB 1.7.6 NOKDB_DataObject 1.8.4 NOKDB_DataObject_FormBuilder 1.0.0RC4 NOKMDB2 2.0.0 NOKDate 1.4.6 NOKHTML_Common 1.2.2 NOKHTML_QuickForm 3.2.5 NOKHTML_QuickForm_advmultiselect 1.1.0 NOKHTML_Table 1.6.1 NOKArchive_Tar 1.1 1.3.13 OKAuth_SASL 1.0.1 NOKConsole_Getopt 1.2 1.3.1 OKNet_SMTP 1.2.8 NOKNet_Socket 1.0.1 NOKNet_Traceroute 0.21 NOKNet_Ping 2.4.1 NOKValidate 0.6.2 NOKxml_RPC 1.4.5 NOKSOAP 0.10.1 NOKLog 1.9.11 NOKArchive_Zip 0.1.2 NOKDo you want me to install/upgrade your PEAR modules[y/n], default to [y]:> yUpgrading PEAR modulesInstalling PEAR modulesDB 1.7.6 1.8.2 OKDB_DataObject 1.8.4 1.11.3 OKDB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OKMDB2 2.0.0 2.4.1 OKHTML_QuickForm_advmultiselect 1.1.0 1.5.1 OKHTML_Table 1.6.1 1.8.3 OKAuth_SASL 1.0.1 1.0.6 OKNet_SMTP 1.2.8 1.6.2 OKNet_Traceroute 0.21 0.21.3 OKNet_Ping 2.4.1 2.4.5 OKValidate 0.6.2 0.8.5 OKXML_RPC 1.4.5 1.5.5 OKSOAP 0.10.1 0.13.0 OKLog 1.9.11 1.12.8 OKArchive_Zip 0.1.2 0.1.2 OKCheck PEAR modulesPEAR 1.4.9 1.9.5 OKDB 1.7.6 1.8.2 OKDB_DataObject 1.8.4 1.11.3 OKDB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OKMDB2 2.0.0 2.4.1 OKDate 1.4.6 1.4.7 OKHTML_Common 1.2.2 1.2.5 OKHTML_QuickForm 3.2.5 3.2.14 OKHTML_QuickForm_advmultiselect 1.1.0 1.5.1 OKHTML_Table 1.6.1 1.8.3 OKArchive_Tar 1.1 1.3.13 OKAuth_SASL 1.0.1 1.0.6 OKConsole_Getopt 1.2 1.3.1 OKNet_SMTP 1.2.8 1.6.2 OKNet_Socket 1.0.1 1.0.14 OKNet_Traceroute 0.21 0.21.3 OKNet_Ping 2.4.1 2.4.5 OKValidate 0.6.2 0.8.5 OKXML_RPC 1.4.5 1.5.5 OKSOAP 0.10.1 0.13.0 OKLog 1.9.11 1.12.8 OKArchive_Zip 0.1.2 0.1.2 OKAll PEAR modules OK------------------------------------------------------------------------Centreon Post Install------------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php OKCreate /etc/centreon/instCentWeb.conf OK------------------------------------------------------------------------Start CentStorage Installation------------------------------------------------------------------------Where is your Centreon Run Dir directory?default to [/var/run/centreon]> Do you want me to create this directory ? [/var/run/centreon][y/n], default to [n]:> yPath /var/run/centreon OWhere is your CentStorage binary directorydefault to [/usr/local/centreon/bin]> yYou select slash...Where is your CentStorage binary directorydefault to [/usr/local/centreon/bin]> Path /usr/local/centreon/bin OKWhere is your CentStorage RRD directorydefault to [/var/lib/centreon]> Path /var/lib/centreon OKPreparing Centreon temporary files/tmp/centreon-setup exists, it will be moved...install www/install/createTablesCentstorage.sql OKCreating Centreon Directory '/var/lib/centreon/status' OKCreating Centreon Directory '/var/lib/centreon/metrics' OKInstall CentStorage binary OKChange right : /var/run/centreon OKChange macros for centstorage init script OKReplace Centstorage default script Macro OKDo you want me to install CentStorage init script ?[y/n], default to [n]:> yCentStorage init script installed OKCentStorage default script installed OKDo you want me to install CentStorage run level ?[y/n], default to [n]:> y Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorageCentStorage Perl lib installed OKInstall logAnalyser OKInstall logAnalyserBroker OKInstall nagiosPerfTrace OKChange macros for centstorage.cron OKInstall CentStorage cron OKChange macros for centstorage.logrotate OKInstall Centreon Storage logrotate.d file OKCreate /etc/centreon/instCentStorage.conf OK------------------------------------------------------------------------Start CentCore Installation------------------------------------------------------------------------Where is your CentCore binary directorydefault to [/usr/local/centreon/bin]> Path /usr/local/centreon/bin OKPreparing Centreon temporary files/tmp/centreon-setup exists, it will be moved...Copy CentCore in binary directory OKChange right : /var/run/centreon OKChange right : /var/lib/centreon OKChange macros for centcore.logrotate OKInstall Centreon Core logrotate.d file OKReplace CentCore init script Macro OKReplace CentCore default script Macro OKDo you want me to install CentCore init script ?[y/n], default to [n]:> yCentCore init script installed OKCentCore default script installed OKDo you want me to install CentCore run level ?[y/n], default to [n]:> y Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcoreCentCore Perl lib installed OKCreate /etc/centreon/instCentCore.conf OK------------------------------------------------------------------------Start CentPlugins Installation------------------------------------------------------------------------Where is your CentPlugins lib directorydefault to [/var/lib/centreon/centplugins]> Do you want me to create this directory ? [/var/lib/centreon/centplugins][y/n], default to [n]:> yPath /var/lib/centreon/centplugins OKPreparing Centreon temporary files/tmp/centreon-setup exists, it will be moved...Change macros for CentPlugins OKInstalling the plugins OKChange right on centreon.conf OKCentPlugins is installed------------------------------------------------------------------------Start CentPlugins Traps Installation------------------------------------------------------------------------
Where is your SNMP configuration directorydefault to [/etc/snmp]> /etc/snmp OKWhere is your CentreonTrapd binaries directorydefault to [/usr/local/centreon/bin]> yYou select slash...Where is your CentreonTrapd binaries directorydefault to [/usr/local/centreon/bin]> /usr/local/centreon/bin OKFinding Apache user : www-dataPreparing Centreon temporary files/tmp/centreon-setup exists, it will be moved...Change macros for snmptrapd.conf OKReplace CentreonTrapd init script Macro OKReplace CentreonTrapd default script Macro OKDo you want me to install CentreonTrapd init script ?[y/n], default to [n]:> yCentreonTrapd init script installed OKCentreonTrapd default script installed OKDo you want me to install CentreonTrapd run level ?[y/n], default to [n]:> y Adding system startup for /etc/init.d/centreontrapd ... /etc/rc0.d/K30centreontrapd -> ../init.d/centreontrapd /etc/rc1.d/K30centreontrapd -> ../init.d/centreontrapd /etc/rc6.d/K30centreontrapd -> ../init.d/centreontrapd /etc/rc2.d/S40centreontrapd -> ../init.d/centreontrapd /etc/rc3.d/S40centreontrapd -> ../init.d/centreontrapd /etc/rc4.d/S40centreontrapd -> ../init.d/centreontrapd /etc/rc5.d/S40centreontrapd -> ../init.d/centreontrapdtrapd Perl lib installed OKInstall : snmptrapd.conf OKInstall : centreontrapdforward OKInstall : centreontrapd OKCreate /etc/centreon/instCentPlugins.conf OK################################################################################ ## Go to the URL : http://ip/centreon/ ## to finish the setup ## ## Report bugs at http://forge.centreon.com ## ## Thanks for using Centreon. ## ----------------------- ## Contact : [email protected] ## http://www.centreon.com ## ################################################################################
以上必須全部是OK,NOK證明某個(gè)地方配置錯(cuò)誤http://ip/centreon
返回404,請檢查配置是否正確(至少配置了有5次,各種版本不同的,請認(rèn)真對待)返回403,是因?yàn)閍pache是2.4以上版本造成的需要修改/etc/apache2/conf.d/centreon.confsudo vim /etc/apache2/conf.d/centreon.confAlias /centreon /usr/local/centreon/www/<Directory "/usr/local/centreon/www"> Options Indexes AllowOverride AuthConfig Options# Order allow,deny# Allow from all Require all granted</Directory>
登錄之后需要簡單配置一下,因配置時(shí)配時(shí)沒有截圖,請參照我下面的官網(wǎng)的鏈接.
centreon界面是英文的,注:/usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/這個(gè)路徑是本地centreon的安裝路徑,可以locate locale|grep centreon查看
1.下載語言文件wget http://cacti-nagios.googlecode.com/files/messages.mo2.創(chuàng)建語言目錄sudo mkdir -p /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/3.移動下載的messages.mo至第2步創(chuàng)建的目錄sudo mv messages.mo /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/4.登錄centreon,點(diǎn)擊administartors,再點(diǎn)option,進(jìn)入”my account”,更改語言為zh_CN保存即可,重新登錄生效.
最好是通過安裝nrpe來實(shí)現(xiàn)分布式監(jiān)控系統(tǒng).
參考:http://www.unixmen.com/install-configure-nagios-4-ubuntu-14-1014-04/(nagios參考)http://blog.chinaunix.net/uid-1838361-id-3599302.html(centreon問題點(diǎn)參考)http://documentation.centreon.com/docs/centreon/en/2.5.x/installation/index.html(官網(wǎng)很詳細(xì))https://forge.centreon.com/projects/centreon/roadmap?tracker_ids%5B%5D=1&tracker_ids%5B%5D=2&completed=1(關(guān)于centreon的一下配置問題可以參考這個(gè),很詳細(xì).)
如有疑問企鵝:壹叁7777452
新聞熱點(diǎn)
疑難解答
圖片精選