Вы находитесь на странице: 1из 21

#############################################

# Instalao e Configurao do Nagios com #


# Centreon e de Cliente Nagios com Centreon #
# no Debian Squeeze
#
#############################################
###########################################
Nome do Servidor: centreon
Ip: 10.101.0.25
Nome do Cliente: ldap
Ip: 10.101.0.26
###########################################
Prepare o seu sistema com o seguinte script wget -c http://www.sixit.com.br/down
load/confinicialsqueeze.sh

###########################################
aptitude update && aptitude dist-upgrade -y
Agora vamos instalar as dependncias
###########################################
aptitude install apache2 libapache2-mod-php5 build-essential php5 libgd-graph-pe
rl postfix libssl-dev openssl -y
aptitude install libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12-dev snmp snmpd
libsnmp-base mc php-pear -y
aptitude install libsnmp9-dev libsasl2-2 libsasl2-modules mutt -y
###########################################
###########################################
Agora vamos criar o usurio para o Nagios

useradd nagios -s /bin/bash -m -r


###########################################
Agora precisamos criar um grupo para o nagios

/usr/sbin/groupadd nagcmd
###########################################
Agora vamos atribuir os usurios nagios e www-data ao grupo nagcmd

/usr/sbin/usermod -a -G nagcmd nagios


/usr/sbin/usermod -a -G nagcmd www-data
###########################################
Agora vamos criar um diretrio em /usr/src para armazenarmos os fontes do nagios
mkdir -p /usr/src/downloads
###########################################
Agora vamos obter os fontes, vamos acessar o diretrio aonde vai ficar armazenado
os fontes
cd /usr/src/downloads
###########################################
Vamos obter o nagios core
wget -c http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.g

z
###########################################
Agora vamos obter os plugins

wget -c http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins
-1.4.16.tar.gz
ou
wget -c https://nagios-plugins.org/download/nagios-plugins-1.4.16.tar.gz
###########################################
Agora vamos obter um thema para o nagios

wget -c http://www.be-root.com/downloads/nagios/vautour/vautour_style.zip
###########################################
Baixando NRPE
wget -c http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
########################################### PAREI
Agora vamos desempacotar o nagios

tar -xzvf nagios-3.4.1.tar.gz


###########################################
Agora vamos acessar o diretrio do nagios para podermos configurar e compilar ele

cd nagios
###########################################
Agora vamos preparar ele para a compilao

./configure --with-command-group=nagcmd
###########################################
Agora vamos compilar o nagios e os cgis

make all
###########################################
Agora vamos instalar o nagios, cgis e os arquivos html

make install
###########################################
Vamos mandar instalar o script de controle do daemon

make install-init
###########################################
Agora precisamos fazer um ajuste neste arquivo o incio do arquivo tem que ficar c
omo abaixo.

vim /etc/init.d/nagios
#!/bin/sh
### BEGIN INIT INFO
# Provides:
nagios
# Required-Start:
$local_fs $remote_fs $network $syslog
# Required-Stop:
$local_fs $remote_fs $network $syslog
# Default-Start:
2 3 4 5

# Default-Stop:
0 1 6
# X-Interactive:
true
# Short-Description: Start/stop nagios server
### END INIT INFO
[...]
###########################################
Agora vamos retirar ele da inicializao

insserv -r -v nagios
###########################################
Agora vamos inserir ele na inicializao

insserv -f -v nagios
###########################################
Agora vamos mandar instalar os arquivos de configurao de exemplo

make install-config
###########################################
Agora vamos mandar instalar e configurar as permisses dos diretrios para os comand
os externos

make install-commandmode
###########################################
Agora vamos mandar instalar a parte web

make install-webconf
###########################################
Vamos mandar instalar o tema classico

make install-classicui
###########################################
Agora vamos acessar o diretrio com os fontes novamente

cd /usr/src/downloads
###########################################
Agora vamos extrair o novo tema

unzip vautour_style.zip -d ./vautour


###########################################
Agora vamos fazer um backup do tema classico

cp -Rfa /usr/local/nagios/share /usr/local/nagios/share_OLD


###########################################
Agora vamos instalar o novo tema

cp -Rfa vautour/* /usr/local/nagios/share/


###########################################
Agora vamos cadastrar o usurio para o acesso ao frontend do nagios

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


###########################################
Agora vamos criar um virtualhost para o nagios caso queira verificar os hosts po
r ele porm mais a frente vamos configurar o virtualhost para o Centreon ;)

vim /etc/apache2/sites-available/nagios
<VirtualHost *:80>
ServerName nagios.sixit.com.br
ServerAdmin rud.nicacio@sixit.com.br
DocumentRoot "/usr/local/nagios/share"
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
ScriptAlias /cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
ServerSignature Off
ErrorLog ${APACHE_LOG_DIR}/nagios-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/nagios-access.log combined
</VirtualHost>
###########################################
Agora vamos desativar o virtualhost default

a2dissite default
###########################################
Agora vamos ativar o virtualhost do nagios

a2ensite nagios
###########################################
Agora vamos remover o arquivo que o nagios instalou no apache

rm -rf /etc/apache2/conf.d/nagios.conf
###########################################
Vamos acessar o diretrio dos fontes


cd /usr/src/downloads
###########################################
Agora vamos instalar os plugins

tar -xzvf nagios-plugins-1.4.16.tar.gz


###########################################
Agora vamos acessar o diretrio dos plugins

cd nagios-plugins-1.4.16/
###########################################
Agora vamos preparar ele para a compilao

./configure --with-nagios-user=nagios --with-nagios-group=nagios


###########################################
Agora vamos mandar compilar ele

make
###########################################
Agora vamos mandar instalar os plugins

make install
###########################################
Agora vamos testar a configurao do nagios

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 3.4.1


Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 05-11-2012
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...

Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check
###########################################
Sempre precisamos ficar atentos com Total Warnings e Total erros, j que no temos n
enhum problema podemos iniciar o nagios

/etc/init.d/nagios start
###########################################
Agora j podemos mandar reiniciar o apache e testar o nagios

/etc/init.d/apache2 restart
########################
INSTALAO NAGIOS COMPLETA
########################

###########################################
Agora so acessar http://nagios.sixit.com.br ou http://ip_servidor usurio: nagiosa
dmin senha: senha que foi definida com htpasswd
Consideraes:
Em Host Detail: Vamos ter informaes de todos os hosts cadastrados e se eles esto up
.
Em Service Detail: Vamos ter informaes sobre todos os servios cadastrados para os h
osts.
###########################################
####### Instalao do Centreon ############
###########################################
###########################################
Agora vamos instalar as dependncias do Centreon

aptitude install sudo heirloom-mailx lsb-release build-essential apache2 apache2


-mpm-prefork php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd -y
aptitude install mysql-server libmysqlclient-dev rrdtool librrds-perl libconfiginifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl -y
aptitude install libgd-gd2-perl snmp snmpd libnet-snmp-perl libsnmp-perl libgd2xpm libgd2-xpm-dev libpng12-dev libsnmp-perl libnet-snmp-perl -y
aptitude install libconfig-inifiles-perl libmcrypt4 libmysqlclient-dev fping lib
ldap2-dev libgnutls-dev libssl-dev smbclient librrdtool-oo-perl -y
###########################################
Agora vamos instalar o ndoutils que um plugin do nagios para alimentar o banco d
e dados o Centreon vai utilizar este plugin para alimentar o banco de dados.
Vamos acessar o diretrio que vamos armazenar os fontes

cd /usr/src/downloads
###########################################
Agora vamos obter o pacote do ndoutils

wget -c http://www.douglas.wiki.br/Downloads/monitoramento/ndoutils-1.5.2.tar.gz
###########################################
Agora vamos desempacotar ele

tar -xzvf ndoutils-1.5.2.tar.gz


###########################################
Agora vamos acessar o diretrio do ndoutils

cd ndoutils-1.5.2/
###########################################
Vamos mandar criar a configurao dele para compilarmos


./configure --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
###########################################
Agora vamos mandar compilar ele

make
###########################################
No execute o meka install vamos copiar os arquivos manualmente vamos seguir a rec
omendao da documentao do Centreon

cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
###########################################
Agora vamos acertar as permisses dos arquivos

chmod 774 /usr/local/nagios/bin/ndo*


chown nagios:nagios /usr/local/nagios/bin/ndo*
###########################################
Agora vamos copiar o arquivo de controle do servio para /etc/init.d

cp ./daemon-init /etc/init.d/ndo2db
###########################################
Agora vamos acertar a permisso dele

chmod +x /etc/init.d/ndo2db
###########################################
Agora vamos inserir ele no inicializao do sistema

insserv -f -v ndo2db
###########################################
Agora vamos acessar o diretrio dos fontes

cd /usr/src/downloads
###########################################
Agora vamos obter o Centreon
wget -c http://www.douglas.wiki.br/Downloads/monitoramento/centreon-2.3.9.tar.gz
###########################################
Agora vamos desempacotar ele

tar -xzvf centreon-2.3.9.tar.gz


###########################################
Agora vamos acessar o diretrio do Centreon

cd centreon-2.3.9
###########################################
Agora vamos mandar executar o script de instalao, quando mandar executar pressione

enter para ler a licena

./install.sh -i
###############################################################################
#
#
#
Centreon (www.centreon.com)
#
#
Thanks for using Centreon
#
#
#
#
v2.3
#
#
#
#
infos@centreon.com
#
#
#
#
Make sure you have installed and configured
#
#
sudo - sed - php - apache - rrdtool - mysql
#
#
#
###############################################################################
-----------------------------------------------------------------------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.
Aps ler a licena, vamos selecionar o que vamos mandar instalar

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
Agora vamos a configurao da instalao da parte Web do Centreon.

-----------------------------------------------------------------------Start CentWeb Installation


-----------------------------------------------------------------------Where is your Centreon directory?
default to [/usr/local/centreon]
> #ENTER

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]
> #ENTER

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]
> #ENTER

Do you want me to create this directory ? [/etc/centreon]


[y/n], default to [n]:
> y
Path /etc/centreon
OK

Where is your Centreon generation_files directory?


default to [/usr/local/centreon]
> #ENTER
Path /usr/local/centreon
OK

Where is your Centreon variable library directory?


default to [/var/lib/centreon]
> #ENTER

Do you want me to create this directory ? [/var/lib/centreon]


[y/n], default to [n]:
> y
Path /var/lib/centreon
OK

Where is your CentPlugins Traps binary


default to [/usr/local/centreon/bin]
> #ENTER

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 the RRD perl module installed [RRDs.pm]


default to [/usr/lib/perl5/RRDs.pm]
> #ENTER
Path /usr/lib/perl5
OK
/usr/bin/rrdtool
OK
/usr/bin/mail
OK

Where is PEAR [PEAR.php]


default to [/usr/share/php/PEAR.php]
> #ENTER
Path /usr/share/php
OK

Where is installed Nagios ?


default to [/usr/local/nagios]
> #ENTER
Path /usr/local/nagios
OK

Where is your nagios config directory


default to [/usr/local/nagios/etc]
> #ENTER
Path /usr/local/nagios/etc
OK

Where is your Nagios var directory ?


default to [/usr/local/nagios/var]
> #ENTER
Path /usr/local/nagios/var
OK

Where is your Nagios plugins (libexec) directory ?


default to [/usr/local/nagios/libexec]
> #ENTER
Path /usr/local/nagios/libexec
OK

Where is your nagios binary ?


default to [/usr/local/nagios/bin/nagios]
> #ENTER
/usr/local/nagios/bin/nagios
OK

Where is your Nagios image directory ?


default to [/usr/local/nagios/share/images/logos]
> #ENTER
Path /usr/local/nagios/share/images/logos
OK

Where is your nagiostats binary ?


default to [/usr/local/nagios/bin/nagiostats]
> #ENTER
/usr/local/nagios/bin/nagiostats
OK
p1_file : /usr/local/nagios/bin/p1.pl
OK
/usr/bin/php
OK
/usr/bin/perl
OK
Finding Apache group :
www-data
Finding Apache user :
www-data
Finding Nagios user :
nagios
Finding Nagios group :
nagios
Aps isso vamos ser questionados sobre a localizao do mdulo do ndoutils precisamos in
formar /usr/local/nagios/bin/ndomod.o

Where is your NDO ndomod binary ?


default to [/usr/sbin/ndomod.o]
> /usr/local/nagios/bin/ndomod.o
/usr/local/nagios/bin/ndomod.o
OK
Agora precisamos acertar a configurao do sudo para o Centreon poder manipular o na
gios

-----------------------------------------------------------------------Configure Sudo
-----------------------------------------------------------------------

Where is sudo configuration file


default to [/etc/sudoers]
> #ENTER
/etc/sudoers
OK
Nagios init script
OK
Your sudo is not configured

Do you want me to configure your sudo ? (WARNING)


[y/n], default to [n]:
> y
Configuring Sudo
OK
Agora vamos a configurao do Apache

-----------------------------------------------------------------------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 right on /usr/local/nagios/share/images/logos
OK
Install nagios documentation
OK
Change macros for insertBaseConf.sql
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
Install libraries
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
Agora o Centreon vai nos questionar sobre os mdulos do pear vamos mandar ele reso
lver as dependncias

-----------------------------------------------------------------------Pear Modules
-----------------------------------------------------------------------Check PEAR modules
PEAR
1.4.9
1.9.1
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
HTML_Common
1.2.2
HTML_QuickForm
3.2.5
HTML_QuickForm_advmultiselect 1.1.0
HTML_Table
1.6.1
Archive_Tar
1.1
Auth_SASL
1.0.1
Console_Getopt
1.2
Net_SMTP
1.2.8
Net_Socket
1.0.1
Net_Traceroute
0.21
Net_Ping
2.4.1
Validate
0.6.2
XML_RPC
1.4.5
SOAP
0.10.1
Log
1.9.11
Archive_Zip
0.1.2

Do you want me to install/upgrade your PEAR


[y/n], default to [y]:
> y
Upgrading PEAR modules
Installing PEAR modules
DB
1.7.6
DB_DataObject
1.8.4
DB_DataObject_FormBuilder
1.0.0RC4
MDB2
2.0.0
HTML_QuickForm_advmultiselect 1.1.0
HTML_Table
1.6.1
Auth_SASL
1.0.1
Net_SMTP
1.2.8
Net_Traceroute
0.21
Net_Ping
2.4.1
Validate
0.6.2
XML_RPC
1.4.5
SOAP
0.10.1
Log
1.9.11
Archive_Zip
0.1.2
Check PEAR modules
PEAR
1.4.9
DB
1.7.6
DB_DataObject
1.8.4
DB_DataObject_FormBuilder
1.0.0RC4
MDB2
2.0.0
Date
1.4.6
HTML_Common
1.2.2
HTML_QuickForm
3.2.5
HTML_QuickForm_advmultiselect 1.1.0
HTML_Table
1.6.1
Archive_Tar
1.1
Auth_SASL
1.0.1
Console_Getopt
1.2
Net_SMTP
1.2.8
Net_Socket
1.0.1
Net_Traceroute
0.21
Net_Ping
2.4.1
Validate
0.6.2
XML_RPC
1.4.5
SOAP
0.10.1
Log
1.9.11

1.3.7
1.2.3

NOK
NOK
NOK
NOK
NOK
OK
NOK
OK
NOK
NOK
NOK
NOK
NOK
NOK
NOK
NOK
NOK

modules

1.7.14
1.10.0
1.0.2
2.4.1
1.5.1
1.8.3
1.0.6
1.6.1
0.21.3
2.4.5
0.8.5
1.5.5
0.13.0
1.12.7
0.1.2

OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK

1.9.4
1.7.14
1.10.0
1.0.2
2.4.1
1.4.7
1.2.5
3.2.13
1.5.1
1.8.3
1.3.7
1.0.6
1.2.3
1.6.1
1.0.10
0.21.3
2.4.5
0.8.5
1.5.5
0.13.0
1.12.7

OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK

Archive_Zip
0.1.2
0.1.2
OK
All PEAR modules
OK
Aps isso vamos receber uma mensagem sobre a criao de dois arquivos de configurao do C
entreon

-----------------------------------------------------------------------Centreon Post Install


-----------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php
OK
Create /etc/centreon/instCentWeb.conf
OK
Agora temos a configurao do CentStorage que quem vai alimentar o banco de dados, n
este processo vamos receber uma mensagem de falha que a respeito do parada do Ce
ntStorage por que ele ainda no esta iniciado no sistema.

-----------------------------------------------------------------------Start CentStorage Installation


-----------------------------------------------------------------------
Where is your Centreon Run Dir directory?
default to [/var/run/centreon]
> #ENTER

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]
> #ENTER
Path /usr/local/centreon/bin
OK

Where is your CentStorage RRD directory


default to [/var/lib/centreon]
> #ENTER
Path /var/lib/centreon
OK
Finding Nagios group :
nagios
Finding Nagios user :
nagios
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
update-rc.d: using dependency based boot sequencing
Configuration file /etc/centreon/conf.pm not found. Exiting.
CentStorage stop
FAIL

Change macros for logAnalyser


OK
Install logAnalyser
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
Create /etc/centreon/instCentStorage.conf
OK
Agora vamos a instalao do Core do Centreon

-----------------------------------------------------------------------Start CentCore Installation


-----------------------------------------------------------------------
Where is your CentCore binary directory
default to [/usr/local/centreon/bin]
> #ENTER
Path /usr/local/centreon/bin
OK
/usr/bin/ssh
OK
/usr/bin/scp
OK
Finding Nagios group :
nagios
Finding Nagios user :
nagios
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
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
update-rc.d: using dependency based boot sequencing
Create /etc/centreon/instCentCore.conf
OK
Agora vamos para a instalao do Plugins do Centreon

-----------------------------------------------------------------------Start CentPlugins Installation


-----------------------------------------------------------------------
Where is your CentPlugins lib directory
default to [/var/lib/centreon/centplugins]
> #ENTER

Do you want me to create this directory ? [/var/lib/centreon/centplugins]


[y/n], default to [n]:
> y
Path /var/lib/centreon/centplugins
OK
Finding Nagios user :
nagios

Finding Nagios group :


nagios
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
Agora vamos a configurao do Snmp

-----------------------------------------------------------------------Start CentPlugins Traps Installation


-----------------------------------------------------------------------
Where is your SNMP configuration directory
default to [/etc/snmp]
> #ENTER
/etc/snmp
OK

Where is your SNMPTT binaries directory


default to [/usr/local/centreon/bin/]
> #ENTER
/usr/local/centreon/bin/
OK
Finding Nagios group :
nagios
Finding Apache user :
www-data
Preparing Centreon temporary files
/tmp/centreon-setup exists, it will be moved...
Change macros for CentPluginsTraps
OK
Installing the plugins Trap binaries
OK
Change macros for snmptrapd.conf
OK
Change macros for snmptt.ini
OK
Install : snmptrapd.conf
OK
Install : snmp.conf
OK
Install : snmptt.ini
OK
Install : snmptt
OK
Install : snmpttconvertmib
OK
Create /etc/centreon/instCentPlugins.conf
OK
Aps estes processos vamos receber a seguinte mensagem

###############################################################################
#
#
#
Go to the URL : http://centreon.linix.com.br/centreon/
#
#
to finish the setup
#
#
#
#
Report bugs at http://forge.centreon.com
#
#
#
#
Thanks for using Centreon.
#
#
----------------------#
#
Contact : infos@centreon.com
#
#
http://www.centreon.com
#
#
#
###############################################################################
###########################################
Agora vamos criar um virtualhost para o centreon, caso no queira criar o virtualh
ost ignore a parte abaixo.

vim /etc/apache2/sites-available/centreon
<VirtualHost *:80>
ServerName centreon.sixit.com.br
ServerAdmin rud.nicacio@sixit.com.br.br

DocumentRoot "/usr/local/centreon/www"

<Directory "/usr/local/centreon/www">
Options Indexes
AllowOverride AuthConfig Options
Order allow,deny
Allow from all
</Directory>
ServerSignature Off
ErrorLog ${APACHE_LOG_DIR}/centreon-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/centreon-access.log combined
</VirtualHost>
###########################################
Agora vamos remover o arquivo padro de configurao padro do centreon para o Apache

rm -rf /etc/apache2/conf.d/centreon.conf
###########################################
Agora vamos carregar o novo virtualhost

a2ensite centreon
###########################################
Agora vamos reiniciar o apache

/etc/init.d/apache2 restart
###########################################
Agora vamos acessar http://centreon.sixit.com.br ou http://ip_servidor/centreon
se voc no configurou o virtualhost
###########################################
Agora vamos a configurao dele siga os passos abaixo.
Nesta primeira tela a Intruduo do que vamos fazer configurar o banco de dados e a
certar algumas variveis do Centreon aqui selecione Start
Nesta prxima tela selecione I Accept e selecione Next
Nesta prxima tela s a questo das variveis que o Centreon est utilizando aqui selecio
ne Next
Nesta prxima tela temos mais alguma variveis que foram mapeadas devem estar tudo
em Verde aqui selecione Next
Nesta prxima tela temos mais algumas variveis referentes aos mdulos Pear aqui sele
cione Next
Nesta prxima tela vamos a configurao do Banco de dados
Em Root password for Mysql informa a senha do root
Em Centreon Database Name deixe o padro: centreon
Em Centstorage Database Name deixe o padro: centstorage
Em NDO Database Name deixe o padro: centstatus
Em Data base Password informe uma senha
Em Confirm it confirme a senha que foi informada acima
Em Database location deixe em branco caso o servidor Mysql seja o localhost
Em Centreon Web Interface location deixe em branco caso o servidor Mysql seja o
localhost

Em MySQL Cliente version (Password HAching Changes) Deixe o valor padro >= 4.1 PASSWORD()
Agora selecione Next
Agora nesta prxima tela vamos ter os valores em verde caso os valores informados
anteriormente ento selecione Next
Nexta prcxima tela informe:
Em Administrator login for Centreon informe o nome de um usurio ex: admin
Em Administrator password informe a senha para o usurio
Em Confirm password confirme a senha informada acima.
Em Administrator firstname informe um nome para ele ex: Administrador
Em Administrator lastname informe um sobrenome pra ele ou obs ex: da Matriz
Em Administrator email informe o email do usurio que vai receber as notificaes que
forem enviadas para o usurio admin.
Agora selecione Next
Agora vamos ser questionados se queremos configurar a autenticao em Ldap vamos sel
ecione No e selecione Next
Na prxima pgina vamos ter informaes sobre a gerao dos arquivos de configurao para o C
reon aqui selecione Next
Na prxima tela vamos ter o resultado da criao do banco de dados e de outras operaes n
o banco aqui selecione Next
Na prxima tela vamos ter alguns links para sites do centreon aqui selecione Click
here to completo your install
Agora vamos ser direcionados para a pgina de login informe o usurio e senha cadast
rado.
Agora j estamos logados no Centreon, aqui precisamos habilitar o centreon para mo
nitorar ele mesmo
Precisamos fazer alguns ajustes no arquivo do snmp

vim /etc/snmp/snmpd.conf
[...]
#Deixe o agentAddress como abaixo
agentAddress udp::161
[...]
#Deixe o rocommunity como abaixo est linha deve estar comentada ento precisamos s d
escomentar ela.
rocommunity public localhost
[...]
#Agora vamos comentar a linha abaixo
# rocommunity public default
-V systemonly
Agora vamos reiniciar o servio do snmp

/etc/init.d/snmpd restart
Agora vamos testar o nosso snmp

/usr/local/nagios/libexec/check_centreon_snmp_remote_storage -n -d "/home" -H lo
calhost -C public -v 1c -w 80 -c 90
Disk OK - /home TOTAL: 2.779GB USED: 0.067GB (2%) FREE: 2.712GB (98%)|size=29838
09024B used=71659520B;2387047219;2685428121;0;2983809024
Agora na Tela Web do Centreon:
Selecione Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Agora vamos iniciar o ndoutils

/etc/init.d/ndo2db start
Agora vamos iniciar o Nagios

/etc/init.d/nagios start
Visualizando os hosts monitorados Agora na tela Web selecione:
Monitoring/Hosts

Agora no painel da esquerda selecione Hosts


Aqui vamos ter todos os hosts que vamos monitorar
Visualizando os servios monitorados Agora na tela Web selecione:
Monitoring/Services
No painel da esquerda selecione All Services
Agora vamos habilitar mais alguns servios padres
Na tela Web selecione:
Configuration/Services
Aqui podemos selecione os servios que queremos monitorar e aps os servios temos um
menu More Actions selecione Enable para habilitar os servios.
Agora vamos acertar os servios que vo ser adicionados por padro dependendo do templ
ate. Na tela Web selecione:
Configuration/Services
Agora no painel lateral da esquerda selecione Templates
Agora vamos pegar um servio de exemplo selecione SNMP-Disc-/usr
Agora selecione a aba Relations
Agora adicione os host templates que vo ter este servio como padro ex: Servers-Linu
x
Agora selecione Save.
Faa o mesmo procedimento para os outros servios que voc acha necessrio deixar como d
efault.
Agora na tela Web selecione:
Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Agora vamos habilitar as notificaes do servios
Agora na tela Web selecione:
Monitoring/Hosts
Agora no painel da esquerda selecione Hosts
Aqui selecione o Centreon-Server
No menu da direita selecione Enable all service notifications on this host
Na mensagem de Submit que vai aparecer s selecione Ok
Agora quando formos consultar os servios no vai aparecer o cone que no servio no esta
habilitado ;)
Para criarmos mais servios selecione:
Configuration/Services
No painel da esquerda selecione Templates
Vamos criar um servio para checar a interface eth0 Selecione:
Configuration/Services
No painel da esquerda selecione Templates
No final da pgina do no painel centra selecione Add
Aqui em Alias informe o nome vou informar eth0
Em Service Template Name precisamos informar o nome do template vou informar eth
0
Em Service Template Model selecione generic-service
Em Check Period selecione 247
Em check Command selecione check_centreon_traffic
Em args:
Em interface informe: eth0
Em warning informe: 80
Em Critical informe: 90
Agora selecione a aba Relations
Aqui adicione Servers-Linux
Agora selecione Save no final da pgina
Agora selecione:
Configuration/Hosts
Aqui selecione Centreon-Server
Agora informe em SNMP Community & Version: public e ao lado na flexinha informe:
1
Agora em Host Templates selecione: Servers-Linux

Agora em Create Service linked to the Template too selecione: yes


Agora selecione Save
Agora vamos exportar a configurao para o nagios Agora selecione:
Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Agora em All Services j vamos ter o monitoramento da interface eth0.
Configurao do Cliente
Vamos instalar os pacotes necessrios no cliente

aptitude update && aptitude install snmp snmpd -y


Agora vamos acertar a configurao do snmp

vim /etc/snmp/snmpd.conf
[...]
#Vamos deixar o agentAddress como abaixo
agentAddress udp::161
[...]
#Vamos comentar a linha abaixo
# rocommunity public default
-V systemonly
#Agora vamos adicionar a seguinte linha
rocommunity rud.nicacio 10.101.0.0/24
Agora vamos reiniciar o servio do snmp

/etc/init.d/snmpd restart
Agora no servidor vamos testar o snmp que foi configurado no cliente

/usr/local/nagios/libexec/check_centreon_snmp_remote_storage -n -d "/home" -H 10
.101.0.26 -C douglas -v 1c -w 80 -c 90
Disk OK - /home TOTAL: 2.779GB USED: 0.067GB (2%) FREE: 2.712GB (98%)|size=29838
09024B used=71643136B;2387047219;2685428121;0;2983809024
Agora vamos cadastrar o cliente na tela do Centreon Selecione:
Configuration/Hosts
Agora selecione Add
Em Host Name informe um nome para o cliente ex: Ldap
Em alias informe uma descrio para o host ex: Servidor Ldap
Em IP Address /DNS informe o ip do cliente ex: 10.101.0.26
Em SNMP community & Version informe: douglas na flexina lateral selecione 1.
Em Host Templates Selecione Add a template
Agora em Host Templete Selecione: Server-Linux
Agora em Create Services linked to the Template too selecione: yes
Agora na aba Relations
Agora adicione Linux-Servers
Agora selecione Save.
Agora vamos exportar a configurao para o nagios Agora selecione:
Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Na tela Web selecione:
Configuration/Services
Aqui podemos selecione os servios que vai querer monitorar no cliente e aps os ser
vios temos um menu More Actions selecione Enable para habilitar os servios.
Agora vamos exportar a configurao para o nagios Agora selecione:
Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Agora na tela Web selecione:
Monitoring/Hosts
Agora no painel da esquerda selecione Hosts
Aqui selecione o Ldap

No menu da direita selecione Enable all service notifications on this host


Na mensagem de Submit que vai aparecer s selecione Ok
Agora em Configuration/Services/Services by host
Aqui selecione algum servio por ex: Disk-/home
Selecione a aba Relations
Agora selecione o cliente para adicionar a este servio.
Agora vamos exportar a configurao para o nagios Agora selecione:
Configuration/Nagios
Agora selecione Move Export Files e selecione tambm Restart Nagios agora selecion
e Export
Agora galera s ir acompanhando os logs e cadastrando os hosts ;)
Referncias
1. http://www.nagios.org/
2. http://www.nagios.org/documentation
3. http://library.nagios.com/library/products/nagioscore/manuals/
4. http://nagios.sourceforge.net/docs/3_0/quickstart.html
5. http://support.nagios.com/knowledgebase/faqs
6. http://support.nagios.com/wiki/index.php/Main_Page
7. http://nagiosplugins.org/man/check_disk
8. http://nagios-br.com/
9. http://nagios.sourceforge.net/docs/ndoutils/NDOUtils.pdf
10. http://nagios.sourceforge.net/docs/ndoutils/NDOUtils_DB_Model.pdf
11. http://blog.gnucom.cc/2009/event-handlers-in-nagios-using-nrpe/
12. http://www.centreon.com/
13. http://en.doc.centreon.com/Main_Page
14. http://forum.centreon.com/
15. http://www.centreon.com/Content-Products-IT-network-monitoring/screenshots-f
or-centreon-it-monitoring-centreon
16. https://demo.centreon.com/index.php