ubuntu 14.04 nagios4+ndoutils2.0+centreon2.5.4(原创)
开发应用centreon是开源的IT监控软件,由法国人于2003年开发,最初名为Oreon,并于2005年正式更名为centreon。centreon作为nagios的分布式监控管理平台,其功能之强大,打造了centreon在IT监控方面强势地位,它的底层使用nagios监控软件,nagios通过ndoutil模块将监控数据写入数据库,centreon读取该数据并即时的展现监控信息,通过centreon可以简单地管理和配置所有nagios,因此,完全可以使用centreon轻易的搭建企业级分布式IT基础运维监控系统
功能优点1、gui方式添加host,支持hosttemplate与servicestemplate,自动建立关联服务,与nagios+cacti相比配置方便简单。2、支持graphtemplate,添加servcie时自动添加graph,不必象nagios+cacti监控与流量图设置2步走。3、host监控可以全部采用nrpe方式,不必象nagios+cacti生成流量图必须使用snmp。4、支持多节点分布式监控,nagios+cacti的分布式监控现在想起来都头痛。5、支持acl权限管理方式,对用户权限限制到菜单项,nagios+cacti一个帐号大家用过时啦。6、详细的日志管理功能,日志搜索过滤都支持7、功能模块化管理,想要新功能官方没有怎么办,自己写去。<---以上摘自百度百科-->
简单介绍一下nagios本身是监控工具,配置起来比较麻烦,而且不直观,nagios在这里作为监控引擎存在,ndo2db是nagios和MySQL交互的工具,nagiso通过ndo2db对数据库进行读写.centreon利用nagios引擎,通过web有好界面配置nagios,来达到监控和报警,以及利用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
如果报这个错误/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
就执行sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/conf.d/nagios.conf
加入开机启动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软件主要是用于将数据存数据库,然后又可读取出来,它在nagios与centerton之间接收和发送数据。
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
看到网上很多文章都说要要修改ndo2db.cfg,ndomod.cfg,nagios.cfg文件的参数,其实是不用修改的,因为配置centreon时还是会覆盖了之前修改的配置文件的.如果要测试ndo2db和nagios之间是否可以读写数据的话,是要配置ndo2db.cfg,ndomod.cfg,nagios.cfg这三个文件的.
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有报错,请自行google,如果nagios不能通过ndo2db往mysql中写入数据的话,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次,各种版本路径好像是不同的,请认真对待......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 : infos@centreon.com ## http://www.centreon.com ## ################################################################################
以上必须全部是OK,NOK证明某个地方配置错误http://ip/centreon
返回404,请检查配置是否正确(至少配置了有5次,各种版本不同的,请认真对待)返回403,是因为apache是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>
登录之后需要简单配置一下,因配置时配时没有截图,请参照我下面的官网的链接.
centreon界面是英文的,注:/usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/这个路径是本地centreon的安装路径,可以locate locale|grep centreon查看
1.下载语言文件wget http://cacti-nagios.googlecode.com/files/messages.mo2.创建语言目录sudo mkdir -p /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/3.移动下载的messages.mo至第2步创建的目录sudo mv messages.mo /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/4.登录centreon,点击administartors,再点option,进入”my account”,更改语言为zh_CN保存即可,重新登录生效.
最好是通过安装nrpe来实现分布式监控系统.
参考:http://www.unixmen.com/install-configure-nagios-4-ubuntu-14-1014-04/(nagios参考)http://blog.chinaunix.net/uid-1838361-id-3599302.html(centreon问题点参考)http://documentation.centreon.com/docs/centreon/en/2.5.x/installation/index.html(官网很详细)https://forge.centreon.com/projects/centreon/roadmap?tracker_ids%5B%5D=1&tracker_ids%5B%5D=2&completed=1(关于centreon的一下配置问题可以参考这个,很详细.)
如有疑问企鹅:壹叁7777452
新闻热点
疑难解答
图片精选