Saturday, February 16, 2013

Installing Centreon 2.4 on CentOS 6.3 x64 - Step by Step - Part 2

This is the continuation of Installing Centreon 2.4 on CentOS 6.3 x64 - Step by Step

Preparing MySQL

## Add innodb_file_per_table=1 under the [mysqld] section in my.cnf
vim /etc/my.cnf

## then
service mysqld start
chkconfig mysqld on
# 

Installing Centreon

#
service httpd start
groupadd centreon
useradd -g centreon centreon
cd /usr/local/src/
wget http://download.centreon.com/index.php?id=4264

tar -zxf centreon-2.4.0.tar.gz
cd centreon-2.4.0
export PATH="$PATH:/usr/local/nagios/bin/"

# create an answer file with the following contents:
vim ./answer
#
And create the answer file with the following content:
## CentWeb: Web front Centreon for Nagios
PROCESS_CENTREON_WWW=1
## CentStorage: Log and charts archiving.
PROCESS_CENTSTORAGE=1
## CentCore: Distributed Monitoring engine.
PROCESS_CENTCORE=1
## CentPlugins: Centreon Plugins for nagios
PROCESS_CENTREON_PLUGINS=1
## CentTraps: Centreon Snmp traps process for nagios
PROCESS_CENTREON_SNMP_TRAPS=1

#####################################################################
## Begin: Default variables
#####################################################################
## Your default variables
## $BASE_DIR is the centreon source directory
LOG_DIR="$BASE_DIR/log"
LOG_FILE="$LOG_DIR/install_centreon.log"

## Don't change values above unless you perfectly understand
## what you are doing.
## Centreon temporary directory to work
TMP_DIR="/tmp/centreon-setup"
## default snmp config directory
SNMP_ETC="/etc/snmp/"
## a list of pear modules require by Centreon
PEAR_MODULES_LIST="pear.lst"
#####################################################################
## End: Default variables
##################################################################


#####################################################################
## Begin: Centreon preferences
#####################################################################
## Above variables are necessary to run a silent install
## Where you want to install Centreon (Centreon root directory)
INSTALL_DIR_CENTREON="/usr/local/centreon"
## Centreon log files directory
CENTREON_LOG="/usr/local/centreon/log"
## Centreon config files
CENTREON_ETC="/etc/centreon"
## Where is your Centreon binaries directory ?
CENTREON_BINDIR="/usr/local/centreon/bin"
## Where is your Centreon data informations directory ?
CENTREON_DATADIR="/usr/local/centreon/data"
## Centreon generation config directory
##  filesGeneration and filesUpload
## Where is your Centreon generation_files directory ?
CENTREON_GENDIR="/usr/local/centreon"
## libraries temporary files directory
## Where is your Centreon variable library directory ?
CENTREON_VARLIB="/var/lib/centreon"
## Where is your CentPlugins Traps binary?
CENTPLUGINSTRAPS_BINDIR="/usr/local/centreon/bin"
## Where is the RRD perl module installed [RRDs.pm]
## ATTENTION: ON x64 SYSTEMS THE PATH IS LIB64 INSTEAD OF LIB
##               vv
RRD_PERL="/usr/lib64/perl5"
## What is the Centreon group ?
CENTREON_GROUP="centreon"
## What is the Centreon user ?
CENTREON_USER="centreon"
## What is the Monitoring engine user ?
MONITORINGENGINE_USER="nagios"
## What is the Monitoring engine group ?
MONITORINGENGINE_GROUP="nagios"
## What is the Monitoring engine log directory ?
MONITORINGENGINE_LOG="/usr/local/nagios/var"
## Where is your monitoring plugins (libexec) directory ?
PLUGIN_DIR="/usr/local/nagios/libexec"
## Path to sudoers file (optional)
## Where is sudo configuration file
SUDO_FILE="/etc/sudoers"
## What is the Monitoring engine init.d script ?
MONITORINGENGINE_INIT_SCRIPT="/etc/init.d/nagios"
## What is the Monitoring engine binary ?
MONITORINGENGINE_BINARY="/usr/local/nagios/bin/nagios"
## What is the Monitoring engine configuration directory ?
MONITORINGENGINE_ETC="/usr/local/nagios/etc"
## Where is the configuration directory for broker module ?
BROKER_ETC="/usr/local/nagios/etc"
## Where is the init script for broker module daemon ?
BROKER_INIT_SCRIPT="/etc/init.d/ndo2db"
## Do you want me to configure your sudo ? (WARNING)
FORCE_SUDO_CONF=1

#####################################################################
## Begin: Apache preferences
#####################################################################
## Apache configuration directory (optional)
#DIR_APACHE="/etc/apache"
## Apache local specific configuration directory (optional)
## Do you want to update Centreon Apache sub configuration file ?
# DIR_APACHE_CONF="/etc/apache/conf.d"
## Apache configuration file. Only file name. (optional)
#APACHE_CONF="apache.conf"
## Apache user (optional)
WEB_USER="apache"
## Apache group (optional)
WEB_GROUP="apache"
## Force apache reload (optional): set APACHE_RELOAD to 1
## Do you want to reload your Apache ?
APACHE_RELOAD=1
#####################################################################
## End: Apache preferences
#####################################################################


## Do you want me to install/upgrade your PEAR modules
PEAR_AUTOINST=1
## Centreon run dir (all .pid, .run, .lock)
## Where is your Centreon Run Dir directory?
CENTREON_RUNDIR="/var/run/centreon"

## path to centstorage binary
## Where is your CentStorage binary directory
CENTSTORAGE_BINDIR="/usr/local/centreon/bin"
## CentStorage RRDs directory (where .rrd files go)
## Where is your CentStorage RRD directory
CENTSTORAGE_RRD="/var/lib/centreon"
## Do you want me to install CentStorage init script ?
CENTSTORAGE_INSTALL_INIT=1
## Do you want me to install CentStorage run level ?
CENTSTORAGE_INSTALL_RUNLVL=1


## path to centcore binary
CENTCORE_BINDIR="usr/local/centreon/bin"
## force install init script (install in init.d)
## Set to "1" to enable
## Do you want me to install CentCore init script ?
CENTCORE_INSTALL_INIT=1
## force install run level for init script (add all link on rcX.d)
## Set to "1" to enable
## Do you want me to install CentCore run level
CENTCORE_INSTALL_RUNLVL=1

## Some plugins require temporary datas to process output.
## These temp datas are store in the CENTPLUGINS_TMP path.
## Where is your CentPlugins lib directory
CENTPLUGINS_TMP="/var/lib/centreon/centplugins"

## path for snmptt installation
SNMPTT_BINDIR="/usr/local/centreon/bin/"
## What is the Broker user ? (optional)
BROKER_USER=$MONITORINGENGINE_USER

## Nagios user (optional)
NAGIOS_USER="nagios"
## Nagios group (optional)
NAGIOS_GROUP="nagios"
## Centreon Connector PATH
## Mail (optional)
BIN_MAIL="/bin/mail"
## 
Save the file and you're ready to install.
# install using the answer file
./install.sh -f ./answer

# After installation configure SELinux
yum -y install policycoreutils-python
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/centreon(/.*)?"
restorecon -R /usr/local/centreon/
semanage fcontext -a -t httpd_sys_rw_content_t "/etc/centreon(/.*)?"
restorecon -R /etc/centreon
semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/nagios/var/spool(/.*)?"
semanage fcontext -a -t httpd_sys_content_t "/usr/local/nagios/share(/.*)?"
restorecon -R /usr/local/nagios/
semanage fcontext -a -t httpd_sys_content_t "/usr/share/php(/.*)?"
restorecon -R /usr/share/php
semanage fcontext -a -t httpd_sys_content_t "/usr/share/pear(/.*)?"
restorecon -R /usr/share/pear

# Restart some services
service httpd restart
service ndo2db restart
service nagios restart
#

When the installation is finished, open http://server/centreon/ in the browser.

Next, Next




At the third page:

  • Nagios directory: /usr/local/nagios/
  • Nagiostats binary: /usr/local/nagios/bin/nagiostats
  • Nagios image directory: /usr/local/nagios/share/images

At the forth page:
  • Broker Module: ndoutils
  • Ndomod binary (ndomod.o): /usr/local/nagios/bin/ndomod.o

At the fifth page enter the details of the admin user.


At the 6th page you have to specify the db details. By default the mysql root password is blank.


After finishing the setup there'll be something wrong with the db so you'll have to go back to the shell to grant permissions for the centreon db user.


#
mysql -e "grant all on centreon.* to 'centreon'@localhost identified by 'CentreonDBPassword';"
mysql -e "grant all on centreon_storage.* to 'centreon'@localhost identified by 'CentreonDBPassword'"
mysql -e "grant all on centreon_status.* to 'centreon'@localhost identified by 'CentreonDBPassword';"
#

37 comments:

  1. EXCELENTE APORTE !!!! GRACIAS

    ReplyDelete
  2. Hi, Great tutorial.

    I'd installed Centreon but I'm having this error when trying to export files:

    sudo: unable to open audit system; Permission denied.

    Would you know what I need to check? I'm just new with Centreon and was hoping to use this on our system.

    Thanks.

    ReplyDelete
    Replies
    1. chano, you can try turning SELinux off completely using the 'setenforce permissive' command.

      Delete
    2. Thanks, I did turned off SELinux and it works.
      Also, I wonder why there's no log files? I did setup a new host and restarted the monitoring engine, but it's not picking up the host. It's not reflected on the top bar and even on the monitoring page. :-( Though, it's saying my poller is running and database is ok. I may have to redo everything again.

      Delete
  3. Hello, Thank you very much for the tutorial.
    I followed all the steps above but after I completed the 6th pae, it comes up with a page which says, " Currently installing database... please do not interrupt this process. Step Status
    Configuration database Add innodb_file_per_table=1 in my.cnf file under the [mysqld] section and restart MySQL Server. "

    It does not change even after 1 hour. Please help me.
    Thanks in advance.

    ReplyDelete
    Replies
    1. did you do the steps from the beginning of this page? if you already have mysql running, use "service mysql restart" instead of start.

      ## Add innodb_file_per_table=1 under the [mysqld] section in my.cnf
      vim /etc/my.cnf
       
      ## then
      service mysqld start

      Delete
  4. Hello,

    Did exactly what is mentioned, however still getting below mentioned error;

    Database Error: Could not connect to database.
    Please contact your administrator.

    Regards,
    Abhishek

    ReplyDelete
    Replies
    1. there could be several reasons... is your mysql server running? is centreon and mysql on the same machine? is the root password correctly specified?

      Delete
    2. I have the same problem as Abishek.
      Centreon and mysql is on the same machine (with CentOS 6.4), i did everything exactly as it is the article above.
      I've issued "service mysqld restart"

      Still nothing...

      Delete
    3. do you see any relevant error message when you tail /var/log/httpd/error_log ?

      Delete
    4. This comment has been removed by the author.

      Delete
    5. This comment has been removed by the author.

      Delete
    6. Solved - mistake in password input process.

      Another one - with such configuration CentCore isnt working and won't start. Everything else, such as mysqld, httpd, centstorage, etc. is up and running.

      Delete
    7. If you get the error ERROR 1133 (42000): Can't find any matching row in the user table after the first UPDATE command, do a FLUSH PRIVILEGES; and try again

      Delete
  5. Great tutorial. But the last few commands for mysql to grant permission on centreon database to centreon user didn't worked for me.
    But I resolved that issue pretty quickly.

    Thanks for your efforts.

    ReplyDelete
  6. last step of answer file installation getting below error

    Where is rrdtool
    default to [/usr/bin/rrdtool]
    > OK

    I just wonder what could be the passwd for http://servername/nagios

    ReplyDelete
  7. Thanks very much for this guide.

    ReplyDelete
  8. I can only describe this tutorial as perfect!

    ReplyDelete
  9. Hello, I get the following error when execute ./install.sh -f ./answer

    Where is ssh binary
    default to [/usr/bin/ssh]
    >
    /usr/bin/ssh is not a valid file. CRITICAL

    I tried with #which ssh, but none
    I have openssh installed...

    ReplyDelete
  10. Is a great tutorial but I have a BIG problem I can't see the hosts :.( in top and in the main... And if I go to Configuration->centreon, in menu:

    Show a table with the poller "Central" and in the column "is Running?" this have the value "No" in color Red, I don't know if this is the problem..

    Please HELP ME!!! I have a lot time with this problem.

    (Sorry for my English)

    ReplyDelete
  11. I can't see my hosts in the main page

    ReplyDelete
    Replies
    1. you just need to start centcore and centstorage. details below

      Delete
  12. When I begin the installation of Centreon it asks where my mail binary is. I do a which mail and it doesn't find anything. Do I have to install postfix to get past this?

    ReplyDelete
  13. Brilliant guide! you just forgot to start centcore and centstorage

    service ndo2db stop
    service nagios stop

    service ndo2db start
    service centcore start
    service centstorage start
    service nagios start
    service httpd restart

    ReplyDelete
  14. Hi,
    Great tutorial, thank you.
    I have finished to make up and running centreon as described in this tutorial in 5 hours but only one thing missing for my case. After adding a host in centreon and exporting it, there's nothing in my monitoring section (even the service).
    Any idea for this ?

    Thanks in advance for you suggestion

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Check if the ndo2db is running I had the same problem, and check the Poller configuration.

      Delete
  15. Thank for Reply Mr. David Bugeja, helped me your contribution, but now I have a new problem I hope you can help me.

    1.- I restart the server and I tried to start the services centcore but thos throw FAILED,

    2.- I want add a new Host, and generated the config file but I get this error:

    Error Unexpected tocken or statement in file '/usr/local/centreon/fileGeneration/nagiosCFG/1/nagºiosa.cfg' on line 18.
    Error processing object config file!

    please if you have any idea, help me.

    ReplyDelete
  16. Same boat as many others, Poller is not running and trying to find out why. ndo2db and nagios are running. Centreon is for the most part working fine, just not polling. Can even save configs. Did have to manage passwords for the mysql accounts, but that is resolved.

    ReplyDelete
  17. I was able to install all modules and access centreon but I am not able to access nagios console.

    ReplyDelete
  18. Hi,
    I can't see the hosts, i have problem to start the centcore service..
    Please help

    ReplyDelete
  19. AWESOME Tutorial Levente Rög, Now I will try to add host to monitoring.

    Best wishes to you!

    Regards.

    ReplyDelete
  20. So, How i can create graphics with monitoring information?

    Thanks in advance!

    ReplyDelete
  21. Hi,

    i have Problem Level 7

    Currently installing database... please do not interrupt this process.

    Step Status
    Configuration database Add innodb_file_per_table=1 in my.cnf file under the [mysqld] section and restart MySQL Server.

    I've added the above MySQL. Gives an error when I make mysql restart.

    Code:
    root@icingamon:/usr/lib64/icinga# /etc/init.d/mysql restart
    Stopping MySQL database server: mysqlderror: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    error: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    .
    error: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    Starting MySQL database server: mysqlderror: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    error: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    error: Found option without preceding group in config file: /etc/mysql/my.cnf at line: 5
    Fatal error in defaults handling. Program aborted
    .
    Checking for corrupt, not cleanly closed and upgrade needing tables..

    ReplyDelete
  22. what about the centcore problem ?????
    please help

    ReplyDelete