189 8069 5689

Nagios和Centreon的安装部署

Centreon是开源的IT监控软件,由法国人于2003年开发,最初名为Oreon,并于2005年正式更名为centreon。

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

曲江ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联建站的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

注:以上内容摘自百度百科


一、准备工作:

1)配置yum源

   最好保证此主机能上Internet,因为光盘内的安装包有些版本比较旧,还有一部分安装包没有,所以如果把光盘作为yum源,会在后面的安装过程中碰到一些麻烦。

[root@Domain01 ~]# cat /etc/yum.repos.d/rhel-internet.repo
[rhel-internet]
name=rhel-internet
baseurl=http://centos.ustc.edu.cn/centos/6/os/x86_64/#中科大yum源
enabled=1
gpgcheck=0

2)安装包下载

http://pan.baidu.com/s/1qWLefKS

以上连接中包括Nagios,Nagios-Plugins,Centreon,RRDtool,ndoutils源码安装包

二、LAMP环境搭建

   如果网络环境好,且硬盘足够大建议最大化安装,因为这样可以最大化的避免源码安装过程中找不到库文件,centreon配置时找不到对应文件的尴尬。

安装之前先安装开发包组:

yum -y groupinstall "Development tools"
yum -y install gd gd-devel

最大化安装LAMP:

yum -y install httpd*
yum -y install MySQL*
yum -y install php*

   由于安装文件比较多,这几步视网络情况可能要花几分钟时间,期间可以上个厕所,沏杯茶,或者刷耍微博之类的。

   如果在安装过程中出现以下错误:

Error Downloading Packages:
  bcel-5.2-7.2.el6.x86_64: failure: Packages/bcel-5.2-7.2.el6.x86_64.rpm from rhel-internet: [Errno 256] No more mirrors to try.

请下载对应的安装包后安装,bcel的rpm包:http://rpm.pbone.net/index.php3?stat=26&dist=74&size=1426424&name=bcel-5.2-7.2.el6.x86_64.rpm 右键另存为即可。

安装过程中如存在依赖关系请使用yum安装:

yum -y install bcel-5.2-7.2.el6.x86_64.rpm

安装完成后记得将httpd,mysqld,加入开机启动中:

[root@Domain01 ~]# chkconfig httpd on
[root@Domain01 ~]# chkconfig mysqld on

开启httpd服务并测试:

service httpd start
service mysqld start
mysqladmin -uroot password 123456

看到如下界面说明安装成功

Nagios和Centreon的安装部署


三、Nagios及相关插件安装

Nagios安装:    

useradd -s /sbin/nologin -G apache nagios #增加Nagios用户,并将其加入apache组中
tar xf nagios-3.4.4.tar.gz
tar xf nagios-3.4.4.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
make install-init && make install-commandmode &&  make install-config && make install-webconf

Nagios-plugins安装:

tar xf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

相关配置:

创建Nagios web登录用户并设置密码

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

防火墙和Selinux设置:

iptables -F  #清除防火墙规则,生产环境慎用
iptables -A INPUT -p tcp --dport 80 -j ACCEPT #开启80端口
setenforce 0 #关闭selinux
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/sysconfig/selinux #在配置文件中永久关闭selinux

ndoutils安装

tar xf ndoutils-1.5.2.tar.gz
cd ndoutils-1.5.2
./configure --prefix=/usr/local/nagios --with-mysql-lib=/usr/lib/mysql --with-mysql-inc=/usr/include/mysql
make
cp src/ndo2db-3x src/file2sock src/log2ndo src/ndomod-3x.o /usr/local/nagios/bin/
cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
chown nagios.nagios /usr/local/nagios/bin/* /usr/local/nagios/etc/ndo*
vim /usr/local/nagios/etc/ndo2db.cfg
--------------------------------------------------------------------------------------------------
     120 db_user=nagios
     121 db_pass=123456
mysql -uroot
     mysql> create database nagios;
     mysql> grant all on nagios.* to nagios@localhost identified by '123456';
     mysql> flush privileges;
     mysql> q
mysql -unagios -p123456 nagios < db/mysql.sql
vim /usr/local/nagios/etc/nagios.cfg
--------------------------------------------------------------------------------------------------
    219 event_broker_options=-1
    220broker_module=/usr/local/nagios/bin/ndomod3x.o
    config_file=/usr/local/nagios/etc/ndomod.cfg  #增加本行代码
/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg

RRDTool安装:

tar xf rrdtool-1.4.7.tar.gz
cd rrdtool-1.4.7
./configure --prefix=/usr/local/rrdtool && make && make install

四、Centreon安装

chmod o=rwx /usr/local/centreon/log
tar -zxvf centreon-2.4.0.tar.gz
cd centreon-2.4.0
./install.sh -i
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]
>
Path /usr/local/centreon                                   OK
Where is your Centreon log directory
default to [/usr/local/centreon/log]
>
Path /usr/local/centreon/log                               OK
Where is your Centreon etc directory
default to [/etc/centreon]
>
Path /etc/centreon                                         OK
Where is your Centreon binaries directory
default to [/usr/local/centreon/bin]
>
Path /usr/local/centreon/bin                               OK
Where is your Centreon data informations directory
default to [/usr/local/centreon/data]
>
Path /usr/local/centreon/data                              OK
Where is your Centreon generation_files directory?
default to [/usr/local/centreon]
>
Path /usr/local/centreon                                   OK
Where is your Centreon variable library directory?
default to [/var/lib/centreon]
>
Path /var/lib/centreon                                     OK
Where is your CentPlugins Traps binary
default to [/usr/local/centreon/bin]
>
Path /usr/local/centreon/bin                               OK
Where is the RRD perl module installed [RRDs.pm]
default to [/usr/lib/perl5/RRDs.pm]
> /usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-multi/RRDs.pm
Path /usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-mOKti
/usr/bin/rrdtool                                           OK
/bin/mail                                                  OK
/usr/bin/php                                               OK
/usr/bin/perl                                              OK
Finding Apache user :                                      apache
Finding Apache group :                                     apache
What is the Centreon group ? [centreon]
default to [centreon]
>
What is the Centreon user ? [centreon]
default to [centreon]
>
What is the Monitoring engine user ?
> centreon                                                    #安装centreon的用户
What is the Broker user ? (optional)
>
What is the Monitoring engine log directory ?
> /usr/local/centreon/log                                    #日志存放目录             
Where is your monitoring plugins (libexec) directory ?
default to [/usr/lib/nagios/plugins]
> /usr/local/nagios/libexec/                                  #libexec路径
Path /usr/local/nagios/libexec/                            OK
Add group centreon to user apache                          OK
Add group centreon to user centreon                        OK
Add group centreon to user apache                          OK
Add group centreon 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                                           #nagios初始路径在哪
What is the Monitoring engine binary ?                     
> /usr/local/nagios/bin/nagios                                 #nagios命令的路径
What is the Monitoring engine configuration directory ?
> /usr/local/nagios/etc/                                       #nagios的etc目录
Where is the configuration directory for broker module ?
> /usr/local/nagios/etc/                                       #ndoutils的路径
Where is the init script for broker module daemon ?
> /usr/local/nagios/bin/ndo2db-3x
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/httpd/conf.d/centreon.conf'                   OK
Configuring Apache                                         OK
Do you want to reload your Apache ?
[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/httpd/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 right on /usr/local/nagios/etc                      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
Change macros for eventReportBuilder.pl                    OK
Change macros for dashboardBuilder.pl                      OK
Install cron directory                                     OK
Change right for eventReportBuilder.pl                     OK
Change right for dashboardBuilder.pl                       OK
Change macros for centreon.logrotate                       OK
Install Centreon logrotate.d file                          OK
Prepare export-mysql-indexes                               OK
Install export-mysql-indexes                               OK
Prepare import-mysql-indexes                               OK
Install import-mysql-indexes                               OK
Prepare indexes schema                                     OK
Install indexes schema                                     OK
------------------------------------------------------------------------
Pear Modules
------------------------------------------------------------------------
Check PEAR modules
PEAR                            1.4.9       1.9.4          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.7          OK
Auth_SASL                       1.0.1                      NOK
Console_Getopt                  1.2         1.2.3          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       1.5.4          OK
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.7.14         OK
DB_DataObject                   1.8.4       1.11.2         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
SOAP                            0.10.1      0.13.0         OK
Log                             1.9.11      1.12.7         OK
Archive_Zip                     0.1.2       0.1.2          OK
Check PEAR modules
PEAR                            1.4.9       1.9.4          OK
DB                              1.7.6       1.7.14         OK
DB_DataObject                   1.8.4       1.11.2         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.13         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.7          OK
Auth_SASL                       1.0.1       1.0.6          OK
Console_Getopt                  1.2         1.2.3          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.4          OK
SOAP                            0.10.1      0.13.0         OK
Log                             1.9.11      1.12.7         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                                     OK
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
Change macros for centstorage binary                       OK
Install CentStorage binary                                 OK
Install library for centstorage                            OK
Change right : /var/run/centreon                           OK
Change macros for centstorage init script                  OK
Do you want me to install CentStorage init script ?
[y/n], default to [n]:
> y
CentStorage init script installed                          OK
Do you want me to install CentStorage run level ?
[y/n], default to [n]:
> y
Change macros for logAnalyser                              OK
Install logAnalyser                                        OK
Change macros for logAnalyser-cbroker                      OK
Install logAnalyser-cbroker                                OK
Change macros for nagiosPerfTrace                          OK
Install nagiosPerfTrace                                    OK
Change macros for purgeLogs                                OK
Install purgeLogs                                          OK
Change macros for purgeCentstorage                         OK
Install purgeCentstorage                                   OK
Change macros for centreonPurge.sh                         OK
Install centreonPurge.sh                                   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
/usr/bin/ssh                                               OK
/usr/bin/scp                                               OK
Preparing Centreon temporary files
/tmp/centreon-setup exists, it will be moved...
Change CentCore Macro                                      OK
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
Do you want me to install CentCore init script ?
[y/n], default to [n]:
> y
CentCore init script installed                             OK
Do you want me to install CentCore run level ?
[y/n], default to [n]:
> y
Create /etc/centreon/instCentCore.conf                     OK
------------------------------------------------------------------------
        Start CentPlugins Installation
------------------------------------------------------------------------
Where is your CentPlugins lib directory
default to [/var/lib/centreon/centplugins]
> y
You select slash...
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 SNMPTT binaries directory
default to [/usr/local/centreon/bin/]
>
/usr/local/centreon/bin/                                   OK
Finding Apache user :                                      apache
Preparing Centreon temporary files
/tmp/centreon-setup exists, it will be moved...
Change macros for CentPluginsTraps                         OK
Change macros for init scripts                             OK
Installing the plugins Trap binaries                       OK
Change macros for snmptrapd.conf                           OK
Change macros for snmptt.ini                               OK
SNMPTT init script installed                               OK
Install : snmptrapd.conf                                   OK
Install : snmp.conf                                        OK
Install : snmptt.ini                                       OK
Install : snmptt                                           OK
Install : snmptthandler                                    OK
Install : snmpttconvertmib                                 OK
Create /etc/centreon/instCentPlugins.conf                  OK
hostname: Unknown host
###############################################################################
#                                                                             #
#                 Go to the URL : http:///centreon/                    #
#                            to finish the setup                              #
#                                                                             #
#                  Report bugs at http://forge.centreon.com                   #
#                                                                             #
#                         Thanks for using Centreon.                          #
#                          -----------------------                            #
#                        Contact : infos@centreon.com                         #
#                          http://www.centreon.com                            #
#                                                                             #
###############################################################################

至此,Centreon安装完成。最后登录http://IP/centreon做初始化。


网站标题:Nagios和Centreon的安装部署
链接地址:http://cdxtjz.cn/article/jcosjd.html

其他资讯