安装Nagios4.0.8 && Centreon2.6.0
操作系统CentOS6.4 64
一. 安装CentOS6.4操作系统,最小化安装
注意事项:
注意配置网关,不然网络连接会有问题
[root@nagios etc]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nagios
GATEWAY=192.168.9.1
同步时间:
yum install crontab*
yum install ntp*
关闭防火墙
service iptables stop
chkconfig iptables off
然后重启系统
reboot
二。安装APACHE 也可根据情况安装NGINX
yum install httpd
usermod -U apache
安装GD库
yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
安装MySQL数据库
yum install openssl-devel perl-DBD-MySQL mysql-server mysql-devel
安装PHP和扩展
yum install php php-mysql php-gd php-ldap php-xml php-mbstring
安装Perl扩展
yum install perl-Config-IniFiles perl-DBI
安装RRDtool
yum install rrdtool perl-rrdtool
安装SNMP
yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp
yum install php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl
安装开发库
yum groupinstall "Development Tools"
其他库
yum install fping glib2-devel
安装PEAR
yum install php-pear
pear channel-update pear.php.net
pear upgrade-all
下载所需用的的软件
wget http://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.4/nagios-4.0.4.tar.gz
wget http://jaist.dl.sourceforge.net/project/nagios/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
wget http://download.centreon.com/centreon/centreon-2.5.0.tar.gz
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
centreon-clapi-1.5.2 下载地址 http://download.centreon.com/index.php?id=4296
安装Nagios
[root@jk soft]# useradd nagios
[root@jk soft]# groupadd nagcmd
[root@jk soft]# usermod -G nagios,nagcmd nagios
[root@jk soft]# tar xvzf nagios-4.0.8.tar.gz
[root@jk soft]# cd nagios-4.0.8
[root@jk nagios-4.0.4]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker --enable-embedded-perl
[root@jk nagios-4.0.4]# make all&&make install&&make install-init&&make install-commandmode&&make install-config&&make install-webconf
安装Nagios插件
[root@jk nagios-4.0.4]# cd ..
[root@jk soft]# tar xvzf nagios-plugins-2.0.tar.gz
[root@jk nagios-plugins-2.0]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
[root@jk nagios-plugins-2.0]# make&&make install
如果出现类似如下错误:
Working in: /soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98
Using Makefile.PL
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /soft/nagios-plugins-2.0/perlmods/Test-Simple-
0.98/blib/lib /soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98/blib/arch /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 6.
BEGIN failed--compilation aborted at Makefile.PL line 6.
make[3]: Entering directory `/soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98'
make[3]: *** No targets specified and no makefile found. Stop.
make[3]: Leaving directory `/soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98'
Can't run make. Please
rm -rf /soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98
to remake from this point) at ../tools/build_perl_modules line 235.
make[2]: *** [all-local] Error 2
make[2]: Leaving directory `/soft/nagios-plugins-2.0/perlmods'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/soft/nagios-plugins-2.0'
make: *** [all] Error 2
这个是缺少Perl模块导致 安装
yum install perl-ExtUtils-MakeMaker
然后再次make&&make install
安装Nrpe
[root@jk nagios-plugins-2.0]# cd ..
[root@jk soft]# tar xvzf nrpe-2.15.tar.gz
[root@jk soft]# cd nrpe-2.15
[root@jk nrpe-2.15]# ./configure
[root@jk nrpe-2.15]# make all&&make install-plugin&&make install-daemon&&make install-daemon-config
安装Ndoutils
[root@jk nrpe-2.15]# cd ..
[root@jk soft]# tar xvzf ndoutils-2.0.0.tar.gz
[root@jk soft]# cd ndoutils-2.0.0
[root@jk ndoutils-2.0.0]# ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
[root@jk ndoutils-2.0.0]# make&&make install
[root@jk ndoutils-2.0.0]# cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg.
[root@jk ndoutils-2.0.0]# cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
[root@jk ndoutils-2.0.0]# cp daemon-init /etc/init.d/ndo2db
修改启动脚本killproc_ndo2db()和 stop)的内容 修改成以下内容:
[root@jk ndoutils-2.0.0]# vi /etc/init.d/ndo2db
killproc_ndo2db ()
{
kill`pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
kill`pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
}
stop)
echo "Stopping $servicename..."
killproc_ndo2db
;;
[root@jk ndoutils-2.0.0]# chmod +x /etc/init.d/ndo2db
[root@jk ndoutils-2.0.0]# chkconfig --add ndo2db
[root@jk ndoutils-2.0.0]# chkconfig --level 345 ndo2db on
安装Centreon
[root@jk ndoutils-2.0.0]# cd ../
[root@jk soft]# tar xvzf centreon-2.6.0.tar.gz
[root@jk soft]# cd centreon-2.6.0
[root@jk centreon-2.5.0]# ./install.sh -i
------------------------------------------------------------------------
Checking all needed binaries
------------------------------------------------------------------------
rm OK
cp OK
mv OK
/bin/chmod OK
/bin/chown OK
echo OK
more OK
mkdir OK
find OK
/bin/grep OK
/bin/cat OK
/bin/sed OK
You will now read Centreon Licence.
Press enter to continue.
安装回车和Q键
然后按Y
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]
>
/usr/local/centreon/etc/
Do you want me to create this directory ? [
/usr/local/centreon/etc/]
[y/n], default to [n]:
> y
Path
/usr/local/centreon/etc/ 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]
>
/usr/local/centreon/var/lib/
Do you want me to create this directory ? [
/usr/local/centreon/var/lib/]
[y/n], default to [n]:
> y
Path /var/lib/centreon OK
/usr/bin/rrdtool OK
/bin/mail OK
/usr/bin/php OK
Where is PEAR [PEAR.php]
default to [/usr/share/php/PEAR.php]
>
/usr/share/pear/PEAR.php
Path /usr/share/pear OK
/usr/bin/perl OK
Finding Apache user : apache
Finding Apache group : apache
What is the Centreon group ? [centreon]
default to [centreon]
>
Do you want me to create this group ? [centreon]
[y/n], default to [n]:
> y
What is the Centreon user ? [centreon]
default to [centreon]
>
Do you want me to create this user ? [centreon]
[y/n], default to [n]:
> y
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 apache OK
Add group centreon to user nagios OK
Add group nagios to user apache 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/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 FAIL
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 apache 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.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.11 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 1.5.5 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_DataObject_FormBuilder 1.0.0RC4 1.0.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.11 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.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 [
/usr/local/centreon/v/var/run/]
>
Do you want me to create this directory ? [
/usr/local/centreon/v/var/run/]
[y/n], default to [n]:
> y
Path
/usr/local/centreon/var/run/ OK
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 sysconfig script Macro OK
Do you want me to install CentStorage init script ?
[y/n], default to [n]:
> y
CentStorage init script installed OK
CentStorage sysconfig script installed OK
Do you want me to install CentStorage run level ?
[y/n], default to [n]:
> y
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 sysconfig script Macro OK
Do you want me to install CentCore init script ?
[y/n], default to [n]:
> y
CentCore init script installed OK
CentCore sysconfig script installed OK
Do you want me to install CentCore run level ?
[y/n], default to [n]:.
> y
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]
> /usr/local/nagios/libexec
Path /usr/local/nagios/libexec 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]
>
/usr/local/centreon/bin OK
Finding Apache user : apache
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 sysconfig script Macro OK
Do you want me to install CentreonTrapd init script ?
[y/n], default to [n]:
> y
CentreonTrapd init script installed OK
CentreonTrapd sysconfig script installed OK
Do you want me to install CentreonTrapd run level
[y/n], default to [n]:
> y
trapd Perl lib installed OK
Install : snmptrapd.conf OK
Install : centreontrapdforward OK
Install : centreontrapd OK
Create /etc/centreon/instCentPlugins.conf OK
安装完后,启动服务
[root@jk centreon-2.5.0]# /etc/init.d/httpd start.
Starting httpd: [ OK ]
[root@jk centreon-2.5.0]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
[root@jk centreon-2.5.0]# mysqladmin -u root -p password 'mysqlpasswd'
[root@jk centreon-2.5.0]# /etc/init.d/ndo2db start
Starting ndo2db: done.
启动nrpe
修改/usr/local/nagios/etc/nrpe.cfg
#allowed_hosts=127.0.0.1 这句修改为
allowed_hosts=127.0.0.1,192.168.1.225
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1这句修改如下
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
启动
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
把上面这句加到/etc/rc.d/rc.loal
这个步骤完成后,我们进行网页端安装
http://192.168.1.225/centreon 打开安装程序
网页安装时,
注意:
数据库安装的使用localhost,不要直接使用ip地址,不然回报权限错误,就是有权限,也会报错。
nagios 的log 文件路径不要修改。/usr/local/nagios/var
后期再修改数据库等各方面信息!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30936525/viewspace-2097961/
,如需转载,请注明出处,否则将追究法律责任。