Friday, September 21, 2012

Installing Centreon on Ubuntu server 12.04

I've been working on this one for quite a while now, and I think I've work MOST of the bugs out of the system. This install is NOT for beginner, if you love your server don't try this on it. The best approach is to create a VM in virtual box and try it there before trying it in a production environment.

So here we go...


After installing your base server and Logging in, the first thing we need to do is install some prerequsistes that Centreon will neeed to run correctly:

~ $ sudo -s
~ # aptitude update
~ # aptitude upgrade
~ # tasksel *Select Lubuntu minimal Install
~ # aptitude install leafpad
~ # aptitude install chromium-browser
~ # aptitude install sysutils mailx lsb-release postfix mailutils
~ # aptitude install build-essential
~ # aptitude install apache2 apache2-mpm-prefork
~ # aptitude install php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd php-gettext
~ # aptitude install mysql-server libmysqlclient15-dev
~ # aptitude install rrdtool librrds-perl
~ # aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl torrus-common libgd-gd2-perl
~ # aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl
~ # aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev
~ # aptitude install phpMyAdmin
Edit /etc/snmp/snmptrapd and change the value of TRAPDRUN from no to yes in /etc/default/snmpd
~ # reboot

Now we need to create a user on the server named nagios, place this user in the proper groups it will need access to:

~ # /usr/sbin/useradd -m nagios
~ # passwd nagios
~ # /usr/sbin/groupadd nagcmd
~ # /usr/sbin/usermod -G nagios,nagcmd nagios
~ # /usr/sbin/usermod -G nagios,nagcmd www-data

Now lets install Nagios, along with the plug-in's you will need for Centreon:

~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
~ # tar xvzf nagios-3.4.1.tar.gz
~ # cd nagios-3.4.1/
~ # ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker
~ # make all
~ # make install
~ # make install-init
~ # make install-commandmode
~ # make install-config
~ # update-rc.d -f nagios defaults
~ # chmod +x /etc/init.d/nagios
~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
~ # tar xvzf nagios-plugins-1.4.15.tar.gz
~ # cd nagios-plugins-1.4.15/
~ # ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl
~ # make
~ # make install

Install NDO:

~ # aptitude install subversion
~ # cd /usr/local/src/
~ # wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz  
~ # tar xvzf ndoutils-1.4b9.tar.gz  
~ # cd ndoutils-1.4b9
~ # wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.4b9_light.patch
~ # patch -p1 -N < ndoutils1.4b9_light.patch
~ # ./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \
   --with-ndo2db-user=nagios --with-ndo2db-group=nagios
~ # make
~ # cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
~ # cp ./src/ndomod-3x.o /usr/sbin/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
~ # chmod 774 /usr/local/nagios/bin/ndo*
~ # chown nagios:nagios /usr/local/nagios/bin/ndo*
~ # cp ./daemon-init /etc/init.d/ndo2db
~ # update-rc.d ndo2db defaults
~ # chmod +x /etc/init.d/ndo2db

Now we are ready to install Centreon itself:

~ # cd /usr/local/src/
~ # wget http://download.centreon.com/centreon/centreon-2.3.8.tar.gz
~ # tar xvzf centreon-2.3.8.tar.gz
~ # cd centreon-2.3.8/
~ # export PATH="$PATH:/usr/local/nagios/bin/"
~ # sudo ./install.sh -i
Scroll to the bottom of the license agreement and accept by clicking "Y ". Answer "Y" for all questions during installation and validate all default paths during installation.

~ # /etc/init.d/apache2 reload

Now load http://YouIP/centreon and follow the wizard to finish the install, on step 6, make sure you have the MySQL database setting correct. Once your finished you should be able to log in with the account you created. Once you are loged in, go to: Configuration→Nagios and check the Boxs "Move Export Files" and Restart Nagios" and then click the [export] button

From the command line run the following commands:

~ # /etc/init.d/nagios start
~ # /etc/init.d/ndo2db start


Your Installation should now start reporting on the basic status of your server. Next time I'll tell you how to start adding other servers in your enviroment to the list of monitered servers.



11 comments:

  1. Hello,

    I following the instructions, but i cant add hosts to centreon list. When i add a host and save its come back to hosts list and dont appear anything.

    Tks

    ReplyDelete
  2. "Now load http://YouIP/centreon and follow the wizard to finish the install, on step 6, make sure you have the MySQL database setting correct. Once your finished you should be able to log in with the account you created. Once you are loged in, go to: Configuration→Nagios and check the Boxs "Move Export Files" and Restart Nagios" and then click the [export] button

    From the command line run the following commands:

    ~ # /etc/init.d/nagios start
    ~ # /etc/init.d/ndo2db start"

    It's very important that you start these services in the correct order, if you don't you will have the problem you describes.

    Also you need to restart the Nagios service every time you add a server also:
    (Go to: Configuration→Nagios and check the Boxs "Move Export Files" and "Restart Nagios" and then click the [export] button)

    Do this after every server you add

    ReplyDelete
  3. Steve, it worked like a charm :-)

    Now I have a weird question for you: I'd like to offer RMM for some of our small/medium business customers. I can't wrap my head around how to set them up as separate entities in Centreon. In other words, I want Customer A to be able to log in and see their "stuff" but nobody else's "stuff." I'm stuck at how to configure that. Can you help?

    ReplyDelete
  4. Hey, sorry it took me so long to answer back, I don't log in very often. As to the question, I don't think can answer that question, I've never done that with my server. I'd have to do some research. If you have figured it out please post and share. I'd like to know the answer myself. :-)

    ReplyDelete
  5. Hello Steve.
    Thanks a lot for you tutorial.
    I've followed it without problems, until I've reached "7 - Installation" into WebGUI...
    Now it reply with this error:

    Configuration database OK
    Storage database OK
    Utils database OK
    Creating database user Query was empty

    Anyone know a way to solve the problem?

    Thanks
    Daniele

    ReplyDelete
  6. That looks like a PHP error, are you sure you have PHP installed correctly?

    ReplyDelete
  7. Hi Steve,
    When I try to restart Nagios from Centreon it shows the following error:

    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

    Reading configuration data...
    Error in configuration file '/usr/local/centreon/filesGeneration/nagiosCFG/1/nagiosCFG.DEBUG' - Line 28 (UNKNOWN VARIABLE)
    Error processing main config file!



    ***> The name of the main configuration file looks suspicious...

    Make sure you are specifying the name of the MAIN configuration file on
    the command line and not the name of another configuration file. The
    main configuration file is typically '/usr/local/nagios/etc/nagios.cfg'

    ***> One or more problems was encountered while processing the config files...

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    'Whats New' section to find out what has changed.


    Great Tutorial anyway.
    Regards

    ReplyDelete
    Replies
    1. hmm I'm note sure what that means..

      what is on line 28 of '/usr/local/centreon/filesGeneration/nagiosCFG/1/nagiosCFG.DEBUG'

      Delete
  8. Hallo,

    I tryed some installation guides and yours is the best!
    But I have a big problem:
    the centstorge libs ar not installed.

    Where is your CentStorage RRD directory
    default to [/var/lib/centreon]
    >
    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
    CentStorage status Directory already exists PASSED
    CentStorage metrics Directory already exists PASSED
    Change macros for centstorage binary OK
    Install CentStorage binary OK
    Install library for centstorage FAIL
    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]:
    >


    So I tryed: Move centreon form /usr/local/src/ to /tmp/ --> found here http://forum.centreon.com/showthread.php/11364-Problems-during-installation-upgrade-2-1-12-to-2-2-0
    But it doesn't work!
    What am I doing work?

    ReplyDelete
    Replies
    1. And after login into localhost/centreon/ I get a fully emty page!

      Delete
  9. ready made centreon and nagios,Just go to http:// www.dlightdaily.com , download and install fullyautomated nagios as per step by step guide

    ReplyDelete