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.