Página Inicial > FreeBSD, Sem categoria, Software Livre > Centreon 2.1.4 on FreeBSD (English)

Centreon 2.1.4 on FreeBSD (English)

This tutorial will guide the User to perform the installation of Centreon on FreeBSD. We will be using an installation in a Jail in FreeBSD kernel version 7.3-PRERELEASE, the kernel version will not influence the tutorial.

What is Centreon?

Centreon is a powerful tool for monitoring hosts and services, it is a frontend that runs on top of Nagios, adding more facilities for viewing and alert history, status, etc. ..

To learn more about the tool, I invite you to visit the official website at the address http://www.centreon.com

What we need?

  • Apache
  • PHP + a lot of dependencies
  • Mysql
  • Nagios
  • Pear + a lot of dependencies
  • Perl + a lot of dependencies
  • rrdtool
  • snmp
  • sudo
  • Centreon (obvious :-p)

Starting installation of packages

Installation of Perl

cd /usr/ports/lang/perl5.10
make install clean

Mark the options:

│ │      [X] PERL_64BITINT  Use 64 bit integers (on i386)          │ │
│ │      [X] THREADS        Build threaded perl                    │ │
│ │      [X] USE_PERL       Rewrite links in /usr/bin              │ │

Installation of BASH:

Basically we use the BASH only to run the installation script

cd /usr/ports/shells/bash
make install clean

Installation SUDO to perform tasks for the Apache User:

cd /usr/ports/security/sudo
make batch=yes install clean

Installation of Apache server:

cd /usr/ports/www/apache20
make install clean

Configure Apache to start with FreeBSD:

echo 'apache2_enable="YES"' >> /etc/rc.conf

Installation of Net-SNMP:

cd /usr/ports/net-mgmt/net-snmp
make install clean

Mark the options:

│ │    [X] IPV6           Build with IPv6 support                  │ │
│ │    [X] MFD_REWRITES   Build with 64-bit Interface Counters     │ │
│ │    [X] PERL           Install additional perl modules          │ │
│ │    [X] PERL_EMBEDDED  Build embedded perl                      │ │
│ │    [X] DUMMY          Enable dummy values as placeholders      │ │

Options for startup service:

mkdir /usr/local/etc/snmp
cp /usr/local/share/snmp/snmpd.conf.example /usr/local/etc/snmp/snmpd.conf
perl -p -i -e 's/com2sec local     localhost       COMMUNITY/com2sec local     localhost       public/g' /usr/local/etc/snmp/snmpd.conf
echo 'snmpd_enable="YES"' >> /etc/rc.conf
echo 'snmpd_pidfile="/usr/local/etc/snmp/snmpd.conf"' >> /etc/rc.conf
/usr/local/etc/rc.d/snmpd start

Installation of PHP5:

cd /usr/ports/lang/php5
make install clean

Mark the options:

│ │[X] CLI        Build CLI version                                │ │
│ │[X] APACHE     Build Apache module                              │ │
│ │[X] IPV6       Enable ipv6 support                              │ │

Configure the PHP:

cd /usr/local/etc
cp php.ini-recommended php.ini

Configure the Apache for use with PHP

echo "AddType application/x-httpd-php .php" >> /usr/local/etc/apache2/httpd.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/etc/apache2/httpd.conf
cat /usr/local/etc/apache2/httpd.conf | sed 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/' > /tmp/httpd.conf && mv /tmp/httpd.conf /usr/local/etc/apache2/httpd.conf

Installation of Database MySQL:

cd /usr/ports/databases/mysql51-server
make install clean

Configure the MySQL for start with FreeBSD:

echo 'mysql_enable="YES"' >> /etc/rc.conf

Installing the dependencies of PHP:

cd /usr/ports/databases/php5-mysql
make install clean
cd /usr/ports/graphics/php5-gd
make BATCH=yes install clean
cd /usr/ports/www/php5-session
make install clean
cd /usr/ports/archivers/php5-zlib
make install clean
cd /usr/ports/sysutils/php5-posix
make install clean
cd /usr/ports/devel/php5-pcre
make install clean

Mark the options:

│ │        [X] BUNDLED_PCRE  Select if you use apache 2.0.x        │ │
cd /usr/ports/security/php5-filter
make install clean
cd /usr/ports/converters/php5-mbstring
make install clean

Mark the options:

│ │           [X] REGEX  Enable multibyte regex support            │ │
cd /usr/ports/textproc/php5-xml
make install clean
cd /usr/ports/textproc/php5-xmlwriter
make install clean
cd /usr/ports/devel/php5-gettext
make install clean

Installation of PEAR and its dependencies:

cd /usr/ports/devel/pear
make install clean
cd /usr/ports/databases/pear-DB_DataObject
make BATCH=yes install clean
cd /usr/ports/databases/pear-DB_DataObject_FormBuilder
make BATCH=yes install clean
cd /usr/ports/databases/pear-MDB2
make install clean
cd /usr/ports/textproc/pear-Numbers_Roman
make install clean
cd /usr/ports/textproc/pear-Numbers_Words
make install clean
cd /usr/ports/devel/pear-HTML_QuickForm2
make install clean
cd /usr/ports/devel/pear-HTML_QuickForm_advmultiselect
make install clean
cd /usr/ports/devel/pear-HTML_Table
make install clean
cd /usr/ports/security/pear-Auth_SASL
make BATCH=yes install clean
cd /usr/ports/graphics/pear-Image_Canvas
make install clean
cd /usr/ports/graphics/pear-Image_Graph
make BATCH=yes install clean
cd /usr/ports/graphics/pear-Image_GraphViz
make BATCH=yes install clean
cd /usr/ports/net/pear-Net_SMTP
make BATCH=yes install clean

Installing some packages in PERL for the Centreon:

cd /usr/ports/devel/p5-Config-IniFiles
make install clean
cd /usr/ports/graphics/p5-GD
make install clean
cd /usr/ports/databases/p5-DBD-mysql
make install clean
cd /usr/ports/security/p5-Crypt-DES
make install clean
cd /usr/ports/security/p5-Digest-HMAC
make install clean
cd /usr/ports/net/p5-IO-INET6
make install clean
cd /usr/ports/net-mgmt/p5-Net-SNMP
make install clean

Installing the main tool for creating graphics, RRDTOOL:

cd /usr/ports/databases/rrdtool
make BATCH=yes install clean

Installation of Nagios 3:

cd /usr/ports/net-mgmt/nagios
make install clean

Mark the options:

│ │[X] EMBEDDED_PERL   Enable embedded Perl [requires Perl 5.8.0+] │ │
│ │[X] NANOSLEEP       Use nanosleep in event timing               │ │
│ │[X] EVENT_BROKER    Enable event broker functionality           │ │

Nagios-plugins:

│ │ [X] FPING    Support for non-flooding fast ping (check_fping)  │ │
│ │ [X] NETSNMP  SNMP support (check_snmp)                         │ │

If you are installing inside a Jail, select the option below:

│ │ [X] JAIL     Compilation within jail(8) (see Makefile)         │ │

Rename the configuration of Nagios (running the shell csh)

cd /usr/local/etc/nagios
foreach arquivo ( "`ls -1`" )
mv $arquivo `echo $arquivo | sed 's/-sample//g'`
end
cd objects
foreach arquivo ( "`ls -1`" )
mv $arquivo `echo $arquivo | sed 's/-sample//g'`
end

Image Pack for Nagios:

cd /usr/ports/misc/nagios-base-logos
make install clean

Installation of NDO-utils:

cd /usr/ports/net-mgmt/ndoutils/
make install clean

Mark the options:

│ │                 [X] MYSQL  MySQL Backend                       │ │

Now is the time we start the installation of Centreon for this, we must first download the installation package Centreon and unpack it in a directory to work:

cd /tmp
fetch http://download.centreon.com/centreon/centreon-2.1.4.tar.gz
tar zxf centreon-2.1.4.tar.gz
cd centreon-2.1.4

Let’s make some adjustments to run on FreeBSD:

perl -p -i -e 's/\/bin\/bash/\/usr\/local\/bin\/bash/g' install.sh
perl -p -i -e 's/\/bin\/bash/\/usr\/local\/bin\/bash/g' libinstall/*
mkdir /usr/local/etc/cron.d
cd /tmp/centreon-2.1.4/tmpl/vardistrib
fetch -o freebsd http://www.luizgustavo.pro.br/blog/wp-content/uploads/2010/02/freebsd.txt

We will now begin installing Centreon:

cd ../..
./install.sh -f tmpl/vardistrib/freebsd

Follow as the video:

When installation is complete, we will leave for the web, so, start MySQL and Apache:

/usr/local/etc/rc.d/apache2 start
/usr/local/etc/rc.d/mysql-server start

We hit a permission not ok:

chown -R www:www /usr/local/etc/centreon/

Now so we can point our browser to the server address Centreon:

http://<ip_ou_url>/centreon

Follow the video to configure web:

still need to export the configuration files for our NDO-Utils to work for that accompanies the video on the export of the same web:

That done, we can initialize the NDO:

echo 'ndo2db_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/ndo2db start

Now, let’s start the process of Centreon:

pw user mod nagios -s /bin/sh
/usr/local/etc/rc.d/centcore start
/usr/local/etc/rc.d/centstorage start

We hit a path within the SUDO:

perl -p -i -e 's/\/etc\/init\.d\/nagios/\/usr\/local\/etc\/rc\.d\/nagios/g' /usr/local/etc/sudoers

Setting the part of CRON for FreeBSD:

cat /usr/local/etc/cron.d/* >> /etc/crontab
/etc/rc.d/cron restart

and now the Nagios:

echo 'nagios_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/nagios start

Finished ! Now you can set up your hosts and start monitoring.

If you need support Centreon, please contact the Mundounix, we offer support and advice for monitoring networks solution.

http://www.mundounix.com.br