GugaBSD

BSD, Linux e software livre em geral.

Centreon 2.3.3 on FreeBSD 9 (Update)

| Comentários

This tutorial will guide the user to complete the installation of Centreon on FreeBSD. We will be using an installation on a FreeBSD 9.0-PRERELEASE kernel version, kernel version does not influence the tutorial. It may be FreeBSD 8.x or 9.x

What is the Centreon?

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

Need Support ? Click Here !

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

What we need? ?

  • Apache
  • PHP 5.3.x + 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

For this tutorial, we will use the tool portmaster, you can even do all the installation manually, but I advise u to use the tool in order to facilitate the installation of the dependencies and the amount of packages that we need.

/usr/ports/ports-mgmt/portmaster
make install clean

if you are using csh shell

rehash

We start by some common packages to provide the Centreon:

# In the package configurations, keep the default settings or to your liking.
portmaster -d lang/perl5.12 www/apache22 shells/bash security/sudo net-mgmt/net-snmp net-mgmt/snmptt

Installing our database (if using MySQL outside, only install mysql-client)

portmaster -d databases/mysql51-client databases/mysql51-server

Let’s go, install the PHP:

Attention to configure PHP5 package, you need some options checked, at least those which are listed below:

│ │ [*] CLI        Build CLI version                               │ │
 │ │ [*] APACHE     Build Apache module                             │ │
portmaster -d lang/php5 databases/php5-mysql graphics/php5-gd 
    www/php5-session archivers/php5-zlib 
    sysutils/php5-posix security/php5-filter 
    converters/php5-mbstring textproc/php5-xml 
    devel/php5-gettext textproc/php5-xmlwriter

PEAR:

portmaster -d devel/pear databases/pear-DB_DataObject databases/pear-DB_DataObject_FormBuilder 
    databases/pear-MDB2 textproc/pear-Numbers_Roman 
    textproc/pear-Numbers_Words devel/pear-HTML_QuickForm2 
    devel/pear-HTML_QuickForm_advmultiselect net/pear-Net_Traceroute 
    net/pear-Net_Ping devel/pear-Validate net/pear-XML_RPC 
    mail/pear-Mail mail/pear-Mail_Mime www/pear-HTTP net/pear-SOAP 
    devel/pear-HTML_Table security/pear-Auth_SASL net/pear-Net_SMTP 
    graphics/pear-Image_Canvas graphics/pear-Image_Graph 
    graphics/pear-Image_GraphViz

Let’s go to the part of Perl:

portmaster -d devel/p5-Config-IniFiles graphics/p5-GD 
    databases/p5-DBD-mysql security/p5-Crypt-DES 
    security/p5-Digest-HMAC net-mgmt/p5-Net-SNMP

Problems with network? implementing security? click here !

An important tool that can not miss in our environment:

portmaster -d databases/rrdtool

And our background of Centreon, Nagios!

portmaster -d net-mgmt/nagios net-mgmt/ndoutils

Check 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 installing in a Jail, check below:

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

ndoutils:

│ │ [X] MYSQL  MySQL Backend                               │ │

Let’s settings for some packages:

if you are using csh shell

rehash

PHP:

cd /usr/local/etc
cp php.ini-production php.ini
# Set the time zone for your location
perl -p -i -e 's/;date.timezone =/date.timezone = America/Sao_Paulo/' /usr/local/etc/php.ini

Apache:

echo 'apache22_enable="YES"' >> /etc/rc.conf
echo "AddType application/x-httpd-php .php" >> /usr/local/etc/apache22/Includes/php.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/etc/apache22/Includes/php.conf
perl -p -i -e 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/g' /usr/local/etc/apache22/httpd.conf

# Make sure your hosts file (/etc/hosts) or internal DNS is working properly
/usr/local/etc/rc.d/apache22 start

Mysql:

echo 'mysql_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/mysql-server start
# set the root password for mysql
mysqladmin -u root password "new-password"

SNMP:

echo 'snmpd_enable="YES"' >> /etc/rc.conf
echo 'snmpd_flags="-a"' >> /etc/rc.conf
echo 'snmpd_conffile="/usr/local/etc/snmp/snmpd.conf"' >> /etc/rc.conf
echo 'snmptrapd_enable="YES"' >> /etc/rc.conf
echo 'snmptrapd_flags="-a -p /var/run/snmptrapd.pid"' >> /etc/rc.conf

mkdir -p /usr/local/etc/snmp
cp /usr/local/share/snmp/snmpd.conf.example /usr/local/etc/snmp/snmpd.conf
perl -p -i -e 's/rocommunity public  default    -V systemonly/rocommunity public default/g' /usr/local/etc/snmp/snmpd.conf
perl -p -i -e 's/agentAddress  udp:127.0.0.1:161/#agentAddress  udp:127.0.0.1:161/' /usr/local/etc/snmp/snmpd.conf
/usr/local/etc/rc.d/snmpd start
/usr/local/etc/rc.d/snmptrapd start

Fix the file /usr/local/etc/snmp/snmpd.conf with location information and identification.

**If you are installing snmpd in a Jail, see this article for the same operation in Jail:
http://ggeek.blogspot.com/2008/10/freebsd-jails-and-net-snmp.html

Consulting in Open Source, contact us!

Nagios:

sh
cd /usr/local/etc/nagios/
ls -1 *-sample | while read arq ; do mv $arq `echo $arq | cut -f1 -d'-'` ; done
cd objects/
ls -1 *-sample | while read arq ; do mv $arq `echo $arq | cut -f1 -d'-'` ; done
exit
echo 'nagios_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/nagios start

NDOUtils:

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

Download Centreon:

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

Making Centreon read the bash shell

There are two ways (choose one):

  • Changing the path the scripts Centreon:
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/*
  • Creating a symbolic link in /bin
ln -s /usr/local/bin/bash /bin/bash

Some preparations for the installation:

mkdir -p /tmp/cron.d
fetch -o tmpl/vardistrib/freebsd http://www.luizgustavo.pro.br/downloads/freebsd.txt

Now start the installation via the command:

bash install.sh -f tmpl/vardistrib/freebsd

Follow the installation process through the video below:

After installation, we will leave for the web part to do so, restart MySQL and Apache:

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

We fix some patches of permission:

chown -R www:www /usr/local/etc/centreon/
cd /usr/local/centreon
rm filesGeneration
mv /var/cache/centreon/filesGeneration .
chown -R www:www filesGeneration
rm filesUpload
mv /var/cache/centreon/filesUpload .
chown -R www:www filesUpload
cd /var/cache/centreon
ln -s /usr/local/centreon/filesGeneration
ln -s /usr/local/centreon/filesUpload

We also fix a problem of dependence on the version of PEAR:

/usr/local/bin/pear uninstall HTML_QuickForm_advmultiselect 
/usr/local/bin/pear install -f pear/HTML_QuickForm_advmultiselect-1.2.0

Now this way, we can point to our broswer centreon server address:

http://<ip_or_url>/centreon

Follow the video to configure the web:

There is less, we still need to export the configuration files for our NDO-Utils to work for it, follow the export of the same video on the web:

Now, let’s start the processes of Centreon:

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

Setting the part of the CRON to FreeBSD:

cat /tmp/cron.d/* >> /etc/crontab
/etc/rc.d/cron restart
rm -rf /tmp/cron.d

Restart nagios processes and ndoutils

/usr/local/etc/rc.d/nagios restart
/usr/local/etc/rc.d/ndo2db restart

Ready! Now just configure your hosts and start monitoring.

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

http://www.mundounix.com.br

Comments