Ubuntu 14.04下Nagios4+NDOUtils2.0+Cntreon2.5.4配置

2022-07-04 12:41:38 浏览数 (1)

开发应用

centreon是开源的IT监控软件,由法国人于2003年开发,最初名为Oreon,并于2005年正式更名为centreon。 centreon作为nagios的分布式监控管理平台,其功能之强大,打造了centreon在IT监控方面强势地位,它的底层使用nagios监控软件,nagios通过ndoutil模块将监控数据写入数据库,centreon读取该数据并即时的展现监控信息,通过centreon可以简单地管理和配置所有nagios,因此,完全可以使用centreon轻易的搭建企业级分布式IT基础运维监控系统。

开源监控解决方案Nagios PNP4Nagios NConf NDOUtils整合部署  http://www.linuxidc.com/Linux/2011-09/42912.htm

功能优点 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 update sudo apt-get install build-essential libgd2-xpm-dev apache2-utils sudo 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/993648 This functionality is already provided by Digest::SHA which is included with perl.

sudo apt-get install snmp-mibs-downloader

安装nagios

sudo useradd -m nagios sudo passwd nagios sudo groupadd nagcmd sudo usermod -a -G nagios,nagcmd nagios sudo 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.gz cd nagios-4.0.8 sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker sudo make all sudo make install sudo make install-init sudo make install-config sudo make install-commandmode sudo make install-webconf sudo 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-plugins wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz tar xzf nagios-plugins-2.0.3.tar.gz cd nagios-plugins-2.0.3 sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios sudo make sudo make install

添加nagios账户 sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

安装ndoutils NDOutils软件主要是用于将数据存数据库,然后又可读取出来,它在nagios与centerton之间接收和发送数据。

wget http://sourceforge.net/projects/nagios/files/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz sudo tar zxvf ndoutils-2.0.0.tar.gz cd ndoutils-2.0.0 sudo ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios sudo make sudo make install

sudo cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg sudo cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg sudo chown nagios:nagios /usr/local/nagios/etc/ndo* sudo chmod 775 /usr/local/nagios/etc/ndo* sudo cp daemon-init /etc/init.d/ndo2db sudo chmod x /etc/init.d/ndo2db sudo update-rc.d ndo2db defaults

sudo vim /usr/local/nagios/etc/nagios.cfg event_broker_options=-1 broker_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 restart sudo /etc/init.d/ndo2db start sudo /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.gz sudo tar zxvf centreon-2.5.4.tar.gz cd centreon-2.5.4 sudo ./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]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do 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]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon binaries directory default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is your Centreon data informations directory default to [/usr/local/centreon/data] > Do you want me to create this directory ? [/usr/local/centreon/data] [y/n], default to [n]: > y Path /usr/local/centreon/data OK Where 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]: > y Path /var/lib/centreon OK /usr/bin/rrdtool OK /usr/bin/mail OK /usr/bin/php OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK /usr/bin/perl OK Finding Apache user : www-data Finding Apache group : www-data What is the Centreon group ? [centreon] default to [centreon] > What is the Centreon user ? [centreon] default to [centreon] > What is the Monitoring engine user ? > nagios What is the Broker user ? (optional) > nagios What is the Monitoring engine log directory ? > /usr/local/nagios/var Where is your monitoring plugins (libexec) directory ? default to [/usr/lib/nagios/plugins] > /usr/local/nagios/libexec Path /usr/local/nagios/libexec OK Add group centreon to user www-data OK Add group centreon to user nagios OK Add group nagios to user www-data OK Add group nagios to user centreon OK ------------------------------------------------------------------------  Configure Sudo ------------------------------------------------------------------------ Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK What is the Monitoring engine init.d script ? > /etc/init.d/nagios What is the Monitoring engine binary ? > /usr/local/nagios/bin/nagios What is the Monitoring engine configuration directory ? > /usr/local/nagios/etc Where is the configuration directory for broker module ? > /usr/local/nagios/etc Where is the init script for broker module daemon ? > /etc/init.d/ndo2db Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK ------------------------------------------------------------------------  Configure Apache server ------------------------------------------------------------------------ Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change macros for insertBaseConf.sql OK Change macros for sql update files OK Change macros for php files OK Change macros for perl binary OK Change right on /usr/local/nagios/etc OK Add group nagios to user www-data OK Add group nagios to user nagios OK Add group centreon to user nagios OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Change right for install directory Change right for install directory OK Install libraries OK Write right to Smarty Cache OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Install cron directory OK Change right for eventReportBuilder OK Change right for dashboardBuilder OK Change macros for centreon.logrotate OK Install Centreon logrotate.d file OK Prepare centFillTrapDB OK Install centFillTrapDB OK Prepare centreon_trap_send OK Install centreon_trap_send OK Prepare centreon_check_perfdata OK Install centreon_check_perfdata OK Prepare centreonSyncPlugins OK Install centreonSyncPlugins OK Prepare centreonSyncArchives OK Install centreonSyncArchives OK Install generateSqlLite OK Install changeRrdDsName.pl OK Prepare export-mysql-indexes OK Install export-mysql-indexes OK Prepare import-mysql-indexes OK Install import-mysql-indexes OK Centreon Web Perl lib installed OK ------------------------------------------------------------------------ Pear Modules ------------------------------------------------------------------------ Check PEAR modules PEAR 1.4.9 1.9.5 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.13 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.3.1 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Archive_Zip 0.1.2 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB 1.7.6 1.8.2 OK DB_DataObject 1.8.4 1.11.3 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.2 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.8 OK Archive_Zip 0.1.2 0.1.2 OK Check PEAR modules PEAR 1.4.9 1.9.5 OK DB 1.7.6 1.8.2 OK DB_DataObject 1.8.4 1.11.3 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.14 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.13 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.3.1 OK Net_SMTP 1.2.8 1.6.2 OK Net_Socket 1.0.1 1.0.14 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.8 OK Archive_Zip 0.1.2 0.1.2 OK All PEAR modules OK ------------------------------------------------------------------------  Centreon Post Install ------------------------------------------------------------------------ Create /usr/local/centreon/www/install/install.conf.php OK Create /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]: > y Path /var/run/centreon O Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > y You select slash... Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/status' OK Creating Centreon Directory '/var/lib/centreon/metrics' OK Install CentStorage binary OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Replace Centstorage default script Macro OK Do you want me to install CentStorage init script ? [y/n], default to [n]: > y CentStorage init script installed OK CentStorage default script installed OK Do 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/centstorage CentStorage Perl lib installed OK Install logAnalyser OK Install logAnalyserBroker OK Install nagiosPerfTrace OK Change macros for centstorage.cron OK Install CentStorage cron OK Change macros for centstorage.logrotate OK Install Centreon Storage logrotate.d file OK Create /etc/centreon/instCentStorage.conf OK ------------------------------------------------------------------------  Start CentCore Installation ------------------------------------------------------------------------ Where is your CentCore binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin OK Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Copy CentCore in binary directory OK Change right : /var/run/centreon OK Change right : /var/lib/centreon OK Change macros for centcore.logrotate OK Install Centreon Core logrotate.d file OK Replace CentCore init script Macro OK Replace CentCore default script Macro OK Do you want me to install CentCore init script ? [y/n], default to [n]: > y CentCore init script installed OK CentCore default script installed OK Do 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/centcore CentCore Perl lib installed OK Create /etc/centreon/instCentCore.conf OK ------------------------------------------------------------------------  Start CentPlugins Installation ------------------------------------------------------------------------ Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed ------------------------------------------------------------------------  Start CentPlugins Traps Installation ------------------------------------------------------------------------

Where is your SNMP configuration directory default to [/etc/snmp] > /etc/snmp OK Where is your CentreonTrapd binaries directory default to [/usr/local/centreon/bin] > y You select slash... Where is your CentreonTrapd binaries directory default to [/usr/local/centreon/bin] > /usr/local/centreon/bin OK Finding Apache user : www-data Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for snmptrapd.conf OK Replace CentreonTrapd init script Macro OK Replace CentreonTrapd default script Macro OK Do you want me to install CentreonTrapd init script ? [y/n], default to [n]: > y CentreonTrapd init script installed OK CentreonTrapd default script installed OK Do 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/centreontrapd trapd Perl lib installed OK Install : snmptrapd.conf OK Install : centreontrapdforward OK Install : centreontrapd OK Create /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.conf sudo vim /etc/apache2/conf.d/centreon.conf Alias /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.mo 2.创建语言目录 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来实现分布式监控系统。

0 人点赞