第一步:配置准备
操作系统:Centos6.5 64位
nagios-3.5.0.tar.gz
ndoutils-1.5.2.tar.gz
centreon-2.3.8.tar.gz
nagios-plugins-1.4.16.tar.gz
nrpe-2.15.tar.gz
第二步:更新
1.rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2.yum update
3.yum upgrade
第三步:关闭防火墙和SELINUX
1.chkconfig --level 35 iptables off
2.vi /etc/selinux/config
将SELINUX=enforcing 修改为:SELINUX=disabled
然后重启系统
reboot
第四步:安装依赖
首先安装APACHE 也可根据情况安装NGINX
1.yum install httpd
2.usermod -U apache
安装GD库
1.yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
安装MySQL数据库
1.yum install openssl-devel perl-DBD-MySQL mysql-server mysql-devel
安装PHP和扩展
1.yum install php php-mysql php-gd php-ldap php-xml php-mbstring
安装Perl扩展
1.yum install perl-Config-IniFiles perl-DBI
安装RRDtool
1.yum install rrdtool perl-rrdtool
安装SNMP
1.yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
2.yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp
3.yum install php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl
安装开发库
1.yum groupinstall "Development Tools"
其他库
1.yum install fping glib2-devel
安装PEAR
1.yum install php-pear
2.pear channel-update pear.php.net
3.pear upgrade-all
第五步:下载我们所需要的软件
把所有的软件都下载到/usr/local/src/下面
1.wget http://jaist.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.5。0/nagios-3.5.0.tar.gz
2.wget http://jaist.dl.sourceforge.net/project/nagios/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz
3.wget http://nagios-plugins.org/download/nagios-plugins-1.4.16.tar.gz
4.wget http://download.centreon.com/centreon/centreon-2.3.8.tar.gz
5.wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
安装Nagios
1.[root@jk soft]# useradd nagios
2.[root@jk soft]# groupadd nagcmd
3.[root@jk soft]# usermod -G nagios,nagcmd nagios
4.[root@jk soft]# tar xvzf nagios-3.5.0.tar.gz
5.[root@jk soft]# cd nagios-3.5.0
6.[root@jk nagios]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker --enable-embedded-perl
7.[root@jk nagios]# make all&&make install&&make install-init&&make install-commandmode&&make install-config&&make install-webconf
安装Nagios插件
1.[root@jk nagios]# cd ..
2.[root@jk soft]# tar nagios-plugins-1.4.16.tar.gz
3.[root@jk nagios-plugins-1.4.16]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
4.[root@jk nagios-plugins-1.4.16]# make&&make install
如果出现类似如下错误:
01.Working in: /soft/ nagios-plugins-1.4.16/perlmods/Test-Simple-0.98
02.Using Makefile.PL
03.Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /soft/ nagios-plugins-1.4.16/perlmods/Test-Simple-
04.0.98/blib/lib /soft/ nagios-plugins-1.4.16/perlmods/Test-Simple-0.98/blib/arch /usr/local/lib64/perl5 /usr/local/share/perl5
05./usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 6.
06.BEGIN failed--compilation aborted at Makefile.PL line 6.
07.make[3]: Entering directory `/soft/ nagios-plugins-1.4.16/perlmods/Test-Simple-0.98'
08.make[3]: *** No targets specified and no makefile found. Stop.
09.make[3]: Leaving directory `/soft/nagios-plugins-2.0/perlmods/Test-Simple-0.98'
10.Can't run make. Please
11.rm -rf /soft/ nagios-plugins-1.4.16/perlmods/Test-Simple-0.98
12.to remake from this point) at ../tools/build_perl_modules line 235.
13.make[2]: *** [all-local] Error 2
14.make[2]: Leaving directory `/soft/ nagios-plugins-1.4.16/perlmods'
15.make[1]: *** [all-recursive] Error 1
16.make[1]: Leaving directory `/soft/ nagios-plugins-1.4.16'
17.make: *** [all] Error 2
这个是缺少Perl模块导致 安装
1.yum install perl-ExtUtils-MakeMaker
然后再次make&&make install
安装Nrpe
1.[root@jk nagios-plugins-1.4.16]# cd ..
2.[root@jk soft]# tar xvzf nrpe-2.15.tar.gz
3.[root@jk soft]# cd nrpe-2.15
4.[root@jk nrpe-2.15]# ./configure
5.[root@jk nrpe-2.15]# make all&&make install-plugin&&make install-daemon&&make install-daemon-config
安装Ndoutils
1.[root@jk nrpe-2.15]# cd ..
2.[root@jk soft]# tar xvzf ndoutils-1.5.2.tar.gz
3.[root@jk soft]# cd ndoutils-1.5.2
4.[root@jk ndoutils-1.5.2]# ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
5.[root@jk ndoutils-1.5.2]# make&&make install
6.[root@jk ndoutils-1.5.2]# cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
7.[root@jk ndoutils-1.5.2]# cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
8.[root@jk ndoutils-1.5.2]# cp daemon-init /etc/init.d/ndo2db
修改启动脚本killproc_ndo2db()和 stop)的内容 修改成以下内容:
01.[root@jk ndoutils-1.5.2]# vi /etc/init.d/ndo2db
02.killproc_ndo2db ()
03.{
04.kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
05.kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
06.}
07.stop)
08.echo "Stopping $servicename..."
09.killproc_ndo2db
10.;;
11.[root@jk ndoutils-1.5.2]# chmod +x /etc/init.d/ndo2db
12.[root@jk ndoutils-1.5.2]# chkconfig --add ndo2db
13.[root@jk ndoutils-1.5.2]# chkconfig --level 345 ndo2db on
在这一步做完以后,要确定一下nagios是否安装成功,如果nagios没有安装成功,那么就要从新安装。如果你登录http://IP/nagios出现如下图所示界面,那么你就可以安装centreon。
安装Centreon
1.[root@jk ndoutils-1.5.2]# cd ../
2.[root@jk soft]# tar xvzf centreon-2.3.8.tar.gz
3.[root@jk soft]# cd centreon-2.3.8
4.[root@jk centreon-2.3.8]# ./install.sh -i
001.------------------------------------------------------------------------
002.Checking all needed binaries
003.------------------------------------------------------------------------
004.rm OK
005.cp OK
006.mv OK
007./bin/chmod OK
008./bin/chown OK
009.echo OK
010.more OK
011.mkdir OK
012.find OK
013./bin/grep OK
014./bin/cat OK
015./bin/sed OK
016.You will now read Centreon Licence.
017.Press enter to continue.
018.安装回车和Q键
019.然后按Y
020.Do you accept GPL license ?
021.[y/n], default to [n]:
022.> y
023.------------------------------------------------------------------------
024.Please choose what you want to install
025.------------------------------------------------------------------------
026.Do you want to install : Centreon Web Front
027.[y/n], default to [n]:
028.> y
029.Do you want to install : Centreon CentCore
030.[y/n], default to [n]:
031.> y
032.Do you want to install : Centreon Nagios Plugins
033.[y/n], default to [n]:
034.> y
035.Do you want to install : Centreon Snmp Traps process
036.[y/n], default to [n]:
037.> y
038.------------------------------------------------------------------------
039.Start CentWeb Installation
040.------------------------------------------------------------------------
041.Where is your Centreon directory?
042.default to [/usr/local/centreon]
043.>
044.Do you want me to create this directory ? [/usr/local/centreon]
045.[y/n], default to [n]:
046.> y
047.Path /usr/local/centreon OK
048.Where is your Centreon log directory
049.default to [/usr/local/centreon/log]
050.>
051.Do you want me to create this directory ? [/usr/local/centreon/log]
052.[y/n], default to [n]:
053.> y
054.Path /usr/local/centreon/log OK
055.Where is your Centreon etc directory
056.default to [/etc/centreon]
057.>
058.Do you want me to create this directory ? [/etc/centreon]
059.[y/n], default to [n]:
060.> y
061.Path /etc/centreon OK
062.Where is your Centreon binaries directory
063.default to [/usr/local/centreon/bin]
064.>
065.Do you want me to create this directory ? [/usr/local/centreon/bin]
066.[y/n], default to [n]:
067.> y
068.Path /usr/local/centreon/bin OK
069.Where is your Centreon data informations directory
070.default to [/usr/local/centreon/data]
071.>
072.Do you want me to create this directory ? [/usr/local/centreon/data]
073.[y/n], default to [n]:
074.> y
075.Path /usr/local/centreon/data OK
076.Where is your Centreon variable library directory?
077.default to [/var/lib/centreon]
078.>
079.Do you want me to create this directory ? [/var/lib/centreon]
080.[y/n], default to [n]:
081.> y
082.Path /var/lib/centreon OK
083./usr/bin/rrdtool OK
084./bin/mail OK
085./usr/bin/php OK
086.Where is PEAR [PEAR.php]
087.default to [/usr/share/php/PEAR.php]
088.> /usr/share/pear/PEAR.php
089.Path /usr/share/pear OK
090./usr/bin/perl OK
091.Finding Apache user : apache
092.Finding Apache group : apache
093.What is the Centreon group ? [centreon]
094.default to [centreon]
095.>
096.Do you want me to create this group ? [centreon]
097.[y/n], default to [n]:
098.> y
099.What is the Centreon user ? [centreon]
100.default to [centreon]
101.>
102.Do you want me to create this user ? [centreon]
103.[y/n], default to [n]:
104.> y
105.What is the Monitoring engine user ?
106.> nagios
107.What is the Broker user ? (optional)
108.> nagios
109.What is the Monitoring engine log directory ?
110.> /usr/local/nagios/var/log
111.Where is your monitoring plugins (libexec) directory ?
112.default to [/usr/lib/nagios/plugins]
113.> /usr/local/nagios/libexec
114.Path /usr/local/nagios/libexec OK
115.Add group centreon to user apache OK
116.Add group centreon to user nagios OK
117.Add group nagios to user apache OK
118.Add group nagios to user centreon OK
119.------------------------------------------------------------------------
120.Configure Sudo
121.------------------------------------------------------------------------
122.Where is sudo configuration file
123.default to [/etc/sudoers]
124.>
125./etc/sudoers OK
126.What is the Monitoring engine init.d script ?
127.> /etc/init.d/nagios
128.What is the Monitoring engine binary ?
129.> /usr/local/nagios/bin/nagios
130.What is the Monitoring engine configuration directory ?
131.> /usr/local/nagios/etc
132.Where is the configuration directory for broker module ?
133.> /usr/local/nagios/etc
134.Where is the init script for broker module daemon ?
135.> /etc/init.d/ndo2db
136.Your sudo is not configured
137.Do you want me to configure your sudo ? (WARNING)
138.[y/n], default to [n]:
139.> y
140.Configuring Sudo OK
141.Configure Apache server
142.------------------------------------------------------------------------
143.Do you want to add Centreon Apache sub configuration file ?
144.[y/n], default to [n]:
145.> y
146.Create '/etc/httpd/conf.d/centreon.conf' OK
147.Configuring Apache OK
148.Do you want to reload your Apache ?
149.[y/n], default to [n]:
150.> y
151.Reloading Apache service FAIL
152.Preparing Centreon temporary files
153.Change right on /usr/local/centreon/log OK
154.Change right on /etc/centreon OK
155.Change macros for insertBaseConf.sql OK
156.Change macros for sql update files OK
157.Change macros for php files OK
158.Change macros for perl binary OK
159.Change right on /usr/local/nagios/etc OK
160.Add group nagios to user apache OK
161.Add group nagios to user nagios OK
162.Add group centreon to user nagios OK
163.Copy CentWeb in system directory
164.Install CentWeb (web front of centreon) OK
165.Change right for install directory
166.Change right for install directory OK
167.Install libraries OK
168.Write right to Smarty Cache OK
169.Copying libinstall OK
170.Change macros for centreon.cron OK
171.Install Centreon cron.d file OK
172.Change macros for centAcl.php OK
173.Change macros for downtimeManager.php OK
174.Install cron directory OK
175.Change right for eventReportBuilder OK
176.Change right for dashboardBuilder OK
177.Change macros for centreon.logrotate OK
178.Install Centreon logrotate.d file OK
179.Prepare centFillTrapDB OK
180.Install centFillTrapDB OK
181.Prepare centreon_trap_send OK
182.Install centreon_trap_send OK
183.Prepare centreon_check_perfdata OK
184.Install centreon_check_perfdata OK
185.Prepare centreonSyncPlugins OK
186.Install centreonSyncPlugins OK
187.Prepare centreonSyncArchives OK
188.Install centreonSyncArchives OK
189.Install generateSqlLite OK
190.Install changeRrdDsName.pl OK
191.Prepare export-mysql-indexes OK
192.Install export-mysql-indexes OK
193.Prepare import-mysql-indexes OK
194.Install import-mysql-indexes OK
195.Centreon Web Perl lib installed OK
196.------------------------------------------------------------------------
197.Pear Modules
198.------------------------------------------------------------------------
199.Check PEAR modules
200.PEAR 1.4.9 1.9.4 OK
201.DB 1.7.6 NOK
202.DB_DataObject 1.8.4 NOK
203.DB_DataObject_FormBuilder 1.0.0RC4 NOK
204.MDB2 2.0.0 NOK
205.Date 1.4.6 NOK
206.HTML_Common 1.2.2 NOK
207.HTML_QuickForm 3.2.5 NOK
208.HTML_QuickForm_advmultiselect 1.1.0 NOK
209.HTML_Table 1.6.1 NOK
210.Archive_Tar 1.1 1.3.11 OK
211.Auth_SASL 1.0.1 NOK
212.Console_Getopt 1.2 1.3.1 OK
213.Net_SMTP 1.2.8 NOK
214.Net_Socket 1.0.1 NOK
215.Net_Traceroute 0.21 NOK
216.Net_Ping 2.4.1 NOK
217.Validate 0.6.2 NOK
218.XML_RPC 1.4.5 1.5.5 OK
219.SOAP 0.10.1 NOK
220.Log 1.9.11 NOK
221.Archive_Zip 0.1.2 NOK
222.Do you want me to install/upgrade your PEAR modules
223.[y/n], default to [y]:
224.> y
225.Upgrading PEAR modules
226.Installing PEAR modules
227.DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK
228.Check PEAR modules
229.PEAR 1.4.9 1.9.4 OK
230.DB 1.7.6 1.7.14 OK
231.DB_DataObject 1.8.4 1.11.2 OK
232.DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK
233.MDB2 2.0.0 2.4.1 OK
234.Date 1.4.6 1.4.7 OK
235.HTML_Common 1.2.2 1.2.5 OK
236.HTML_QuickForm 3.2.5 3.2.13 OK
237.HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK
238.HTML_Table 1.6.1 1.8.3 OK
239.Archive_Tar 1.1 1.3.11 OK
240.Auth_SASL 1.0.1 1.0.6 OK
241.Console_Getopt 1.2 1.3.1 OK
242.Net_SMTP 1.2.8 1.6.2 OK
243.Net_Socket 1.0.1 1.0.14 OK
244.Net_Traceroute 0.21 0.21.3 OK
245.Net_Ping 2.4.1 2.4.5 OK
246.Validate 0.6.2 0.8.5 OK
247.XML_RPC 1.4.5 1.5.5 OK
248.SOAP 0.10.1 0.13.0 OK
249.Log 1.9.11 1.12.7 OK
250.Archive_Zip 0.1.2 0.1.2 OK
251.All PEAR modules OK
252.------------------------------------------------------------------------
253.Centreon Post Install
254.------------------------------------------------------------------------
255.Create /usr/local/centreon/www/install/install.conf.php OK
256.Create /etc/centreon/instCentWeb.conf OK
257.------------------------------------------------------------------------
258.Start CentStorage Installation
259.------------------------------------------------------------------------
260.Where is your Centreon Run Dir directory?
261.default to [/var/run/centreon]
262.>
263.Do you want me to create this directory ? [/var/run/centreon]
264.[y/n], default to [n]:
265.> y
266.Path /var/run/centreon OK
267.Where is your CentStorage binary directory
268.default to [/usr/local/centreon/bin]
269.>
270.Path /usr/local/centreon/bin OK
271.Where is your CentStorage RRD directory
272.default to [/var/lib/centreon]
273.>
274.Path /var/lib/centreon OK
275.Preparing Centreon temporary files
276./tmp/centreon-setup exists, it will be moved...
277.install www/install/createTablesCentstorage.sql OK
278.Creating Centreon Directory '/var/lib/centreon/status' OK
279.Creating Centreon Directory '/var/lib/centreon/metrics' OK
280.Install CentStorage binary OK
281.Change right : /var/run/centreon OK
282.Change macros for centstorage init script OK
283.Replace CentStorage sysconfig script Macro OK
284.Do you want me to install CentStorage init script ?
285.[y/n], default to [n]:
286.> y
287.CentStorage init script installed OK
288.CentStorage sysconfig script installed OK
289.Do you want me to install CentStorage run level ?
290.[y/n], default to [n]:
291.> y
292.CentStorage Perl lib installed OK
293.Install logAnalyser OK
294.Install logAnalyserBroker OK
295.Install nagiosPerfTrace OK
296.Change macros for centstorage.cron OK
297.Install CentStorage cron OK
298.Change macros for centstorage.logrotate OK
299.Install Centreon Storage logrotate.d file OK
300.Create /etc/centreon/instCentStorage.conf OK
301.------------------------------------------------------------------------
302.Start CentCore Installation
303.------------------------------------------------------------------------
304.Where is your CentCore binary directory
305.default to [/usr/local/centreon/bin]
306.>
307.Path /usr/local/centreon/bin OK
308.Preparing Centreon temporary files
309./tmp/centreon-setup exists, it will be moved...
310.Copy CentCore in binary directory OK
311.Change right : /var/run/centreon OK
312.Change right : /var/lib/centreon OK
313.Change macros for centcore.logrotate OK
314.Install Centreon Core logrotate.d file OK
315.Replace CentCore init script Macro OK
316.Replace CentCore sysconfig script Macro OK
317.Do you want me to install CentCore init script ?
318.[y/n], default to [n]:
319.> y
320.CentCore init script installed OK
321.CentCore sysconfig script installed OK
322.Do you want me to install CentCore run level ?
323.[y/n], default to [n]:
324.> y
325.CentCore Perl lib installed OK
326.Create /etc/centreon/instCentCore.conf OK
327.------------------------------------------------------------------------
328.Start CentPlugins Installation
329.------------------------------------------------------------------------
330.Where is your CentPlugins lib directory
331.default to [/var/lib/centreon/centplugins]
332.> /usr/local/nagios/libexec
333.Path /usr/local/nagios/libexec OK
334.Preparing Centreon temporary files
335./tmp/centreon-setup exists, it will be moved...
336.Change macros for CentPlugins OK
337.Installing the plugins OK
338.Change right on centreon.conf OK
339.CentPlugins is installed
340.------------------------------------------------------------------------
341.Start CentPlugins Traps Installation
342.------------------------------------------------------------------------
343.Where is your SNMP configuration directory
344.default to [/etc/snmp]
345.>
346./etc/snmp OK
347.Where is your CentreonTrapd binaries directory
348.default to [/usr/local/centreon/bin]
349.>
350./usr/local/centreon/bin OK
351.Finding Apache user : apache
352.Preparing Centreon temporary files
353./tmp/centreon-setup exists, it will be moved...
354.Change macros for snmptrapd.conf OK
355.Replace CentreonTrapd init script Macro OK
356.Replace CentreonTrapd sysconfig script Macro OK
357.Do you want me to install CentreonTrapd init script ?
358.[y/n], default to [n]:
359.> y
360.CentreonTrapd init script installed OK
361.CentreonTrapd sysconfig script installed OK
362.Do you want me to install CentreonTrapd run level ?
363.[y/n], default to [n]:
364.> y
365.trapd Perl lib installed OK
366.Install : snmptrapd.conf OK
367.Install : centreontrapdforward OK
368.Install : centreontrapd OK
369.Create /etc/centreon/instCentPlugins.conf OK
安装完后,启动服务
1.[root@jk centreon-2.3.8]# /etc/init.d/httpd start
2.Starting httpd: [ OK ]
3.[root@jk centreon-2.3.8]# /etc/init.d/mysqld start
4.Starting mysqld: [ OK ]
5.[root@jk centreon-2.3.8]# mysqladmin -u root -p password 'mysqlpasswd'
6.[root@jk centreon-2.3.8]# /etc/init.d/ndo2db start
7.Starting ndo2db: done.
剩下的就是在Web界面安装,按照提示进行安装即可!