Вы находитесь на странице: 1из 303

02.03.

2012 Cristian Colombini

-1-

1.

Setup of a Central server with engine: Nagios, Broker: ndo2d, database: local MySql 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 Central: Ubuntu server setup Central: First login Central: Necessary components Central: Nagios setup Central: Nagios Plugins setup Central: Ndoutils setup Central: Enable snmp Central: Check services Central: Install Centreon Central: Finishing setup of Centreon Central: Configuring webinterface

2. Setup of a Central server with engine: Nagios, Broker: ndo2d, database: local MySql and setup of its Poller server with engine: Nagios using ndomod 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 Central: Ubuntu server setup Central: First login Central: Necessary components Central: Nagios setup Central: Nagios Plugins setup Central: Ndoutils setup Central: Enable snmp Central: Check services Central: Install Centreon Central: Finishing setup of Centreon Central: Configuring webinterface Poller: Ubuntu server setup Poller: First login Poller: Necessary components Poller: Nagios setup Poller: Nagios Plugins setup Poller: Ndoutils setup Poller: Enable snmp Poller: Check services Central: Add Poller to Central Central: Add Poller to Centreon configuration

3. Setup of a Central server with engine: Nagios, Broker: ndo2d, database: external MySql and setup of its Poller server with engine: Nagios using ndomod 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 MySql: Ubuntu server setup MySql: First login MySql: Necessary components MySql: Enable snmp MySql: Check services MySql: Configure root user of mysql from any hosts Central: Ubuntu server setup Central: First login Central: Necessary components -2-

3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29

Central: Nagios setup Central: Nagios Plugins setup Central: Ndoutils setup Central: Enable snmp Central: Check services Central: Install Centreon Central: Finishing setup of Centreon MySql: Configure centreon user of mysql from any hosts MySql: Reset admin password Central: Configuring webinterface Poller: Ubuntu server setup Poller: First login Poller: Necessary components Poller: Nagios setup Poller: Nagios Plugins setup Poller: Ndoutils setup Poller: Enable snmp Poller: Check services Central: Add Poller to Central Central: Add Poller to Centreon configuration

4. Setup of a Central server with engine: CentEngine, Broker: ndo2d, database: local MySql and setup of its Poller server with engine: Centengine 4.1 NOT WORKING YET

5. Setup of a Central server with engine: Nagios, Broker: Centreon-Broker, database: local MySql and setup of its Poller server with engine: Nagios, Broker: Centreon-Broker 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 5.15 5.16 5.17 5.18 5.19 5.20 5.21 Central: Ubuntu server setup Central: First login Central: Necessary components Central: Nagios setup Central: Nagios Plugins setup Central: Ndoutils setup Central: Centreon-Broker setup Central: Enable snmp Central: Check services Central: Install Centreon Central: Finishing setup of Centreon Central: Configuring Centreon to use Centreon-Broker Poller: Ubuntu server setup Poller: First login Poller: Necessary components Poller: Nagios setup Poller: Nagios Plugins setup Poller: Ndoutils setup Poller: Centreon-Broker setup Poller: Enable snmp Poller: Check services -3-

5.22 5.23 5.24

Central: Add Poller to Central Central: Add Poller to Centreon configuration Central: Configuring Centreon to let the Poller use Centreon-Broker

6. Setup of a Central server with engine: Nagios, Broker: Centreon-Broker, database: external MySql and setup of its Poller server with engine: Nagios, Broker: Centreon-Broker 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.16 6.17 6.18 6.19 6.20 6.21 6.22 6.23 6.24 6.25 6.26 6.27 6.28 6.29 6.30 6.31 6.32 MySql: Ubuntu server setup MySql: First login MySql: Necessary components MySql: Enable snmp MySql: Check services MySql: Configure root user of mysql from any hosts Central: Ubuntu server setup Central: First login Central: Necessary components Central: Nagios setup Central: Nagios Plugins setup Central: Ndoutils setup Central: Centreon-Broker setup Central: Enable snmp Central: Check services Central: Install Centreon Central: Finishing setup of Centreon MySql: Configure centreon user of mysql from any hosts MySql: Reset admin password Central: Configuring Centreon to use Centreon-Broker Poller: Ubuntu server setup Poller: First login Poller: Necessary components Poller: Nagios setup Poller: Nagios Plugins setup Poller: Ndoutils setup Poller: Centreon-Broker setup Poller: Enable snmp Poller: Check services Central: Add Poller to Central Central: Add Poller to Centreon configuration Central: Configuring Centreon to let the Poller use Centreon-Broker

7. Setup of two Central server with engine: Nagios, Broker: Centreon-Broker, database: external MySql and setup of a Poller server with engine: Nagios, Broker: Centreon-Broker 7.1 7.2 7.3 7.4 7.5 7.6 7.7 MySql: Ubuntu server setup MySql: First login MySql: Necessary components MySql: Enable snmp MySql: Check services MySql: Configure root user of mysql from any hosts Central1: Ubuntu server setup -4-

7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.20 7.21 7.22 7.23 7.24 7.25 7.26 7.27 7.28 7.29 7.30 7.31 7.32 7.33

Central1: First login Central1: Necessary components Central1: Nagios setup Central1: Nagios Plugins setup Central1: Ndoutils setup Central1: Centreon-Broker setup Central1: Enable snmp Central1: Check services Central1: Install Centreon Central1: Finishing setup of Centreon MySql: Configure centreon user of mysql from any hosts MySql: Reset admin password Central1: Configuring Centreon to use Centreon-Broker Poller: Ubuntu server setup Poller: First login Poller: Necessary components Poller: Nagios setup Poller: Nagios Plugins setup Poller: Ndoutils setup Poller: Centreon-Broker setup Poller: Enable snmp Poller: Check services Central1: Add Poller to Central Central1: Add Poller to Centreon configuration Central1: Configuring Centreon to let the Poller use Centreon-Broker Central2: Simply clone Central1 to Central2

8. Plugins and others... 8.0 8.1 8.2 8.3 Problems with plugins nagvis syslog geolocation

-5-

-6-

1.

Setup of a Central server with engine: Nagios, Broker: ndo2d, database: local MySql

Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and ndo2db to send data to its local MySql database. 1.1 Central: Ubuntu server setup Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

-7-

-8-

1.2

Central: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com

central central poller000

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

-9-

Restart network services


cd /etc/init.d ./networking restart

1.3

Central: Necessary components

System update Once its installed, proceed with a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

1.4

Central: Nagios setup - 10 -

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

1.5

Central: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz

- 11 -

cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

1.6

Central: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used: - 12 -

ps f | grep ndo2db netstat -apn |grep 5668

1.7

Central: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

1.8

Central: Check services

sysv-rc-conf Check Apche2, MySQL , Nagios , ndo2db , snmpd to startup at 2,3,4 and 5 runlevel And reboot

- 13 -

1.9

Central: Install Centreon

- 14 -

Remember if you have not done before:


export PATH="$PATH:/usr/local/nagios/bin/"

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y

- 15 -

-----------------------------------------------------------------------Start CentWeb Installation -----------------------------------------------------------------------Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory

OK

OK

OK OK OK

OK

OK

- 16 -

default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 17 -

Change macros for dashboardBuilder.pl Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK OK

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install ------------------------------------------------------------------------

- 18 -

Create /usr/local/centreon/www/install/install.conf.php Create /etc/centreon/instCentWeb.conf

OK OK

-----------------------------------------------------------------------Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin]

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 19 -

> Path /usr/local/centreon/bin /usr/bin/ssh /usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed OK OK OK OK nagios nagios

OK OK OK OK OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ Finding Nagios group : Finding Apache user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps Installing the plugins Trap binaries Change macros for snmptrapd.conf Change macros for snmptt.ini Install : snmptrapd.conf Install : snmp.conf Install : snmptt.ini

OK nagios www-data

OK OK OK OK OK OK OK

- 20 -

Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ############################################################################### # # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start 1.10 Central: Finishing setup of Centreon

Connect via browser to http://yourcentral-ip/centreon

- 21 -

- 22 -

1.11

Central: Configuring webinterface

broker_module=

/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg event_broker_options=-1

- 23 -

Correct the errors:

- 24 -

Reboot After restart check services restarting them: Service centcore restart Service centstorage restart Check for no errors output! If necessary : service ndo2db restart service nagios restart

- 25 -

2. Setup of a Central server with engine: Nagios, Broker: ndo2d, database: local MySql and setup of its Poller server with engine: Nagios using ndomod Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and ndo2db to send data to its local MySql database. 2.1 Central: Ubuntu server setup Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

- 26 -

- 27 -

2.2

Central: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com

central central poller000

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

- 28 -

Restart network services


cd /etc/init.d ./networking restart

2.3

Central: Necessary components

System update Once its installed, proceed with a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

2.4

Central: Nagios setup - 29 -

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

2.5

Central: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz

- 30 -

cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

2.6

Central: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used: - 31 -

ps f | grep ndo2db netstat -apn |grep 5668

2.7

Central: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

2.8

Central: Check services

sysv-rc-conf Check Apche2, MySQL , Nagios , ndo2db , snmpd to startup at 2,3,4 and 5 runlevel And reboot

- 32 -

2.9

Central: Install Centreon

- 33 -

Remember if you have not done before:


export PATH="$PATH:/usr/local/nagios/bin/"

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y

- 34 -

-----------------------------------------------------------------------Start CentWeb Installation -----------------------------------------------------------------------Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory

OK

OK

OK OK OK

OK

OK

- 35 -

default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 36 -

Change macros for dashboardBuilder.pl Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK OK

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install ------------------------------------------------------------------------

- 37 -

Create /usr/local/centreon/www/install/install.conf.php Create /etc/centreon/instCentWeb.conf

OK OK

-----------------------------------------------------------------------Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin]

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 38 -

> Path /usr/local/centreon/bin /usr/bin/ssh /usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed OK OK OK OK nagios nagios

OK OK OK OK OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ Finding Nagios group : Finding Apache user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps Installing the plugins Trap binaries Change macros for snmptrapd.conf Change macros for snmptt.ini Install : snmptrapd.conf Install : snmp.conf Install : snmptt.ini

OK nagios www-data

OK OK OK OK OK OK OK

- 39 -

Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ############################################################################### # # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start 2.10 Central: Finishing setup of Centreon

Connect via browser to http://yourcentral-ip/centreon

- 40 -

- 41 -

2.11

Central: Configuring webinterface

broker_module=

/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg event_broker_options=-1

- 42 -

Correct the errors:

- 43 -

Reboot After restart check services restarting them: Service centcore restart Service centstorage restart Check for no errors output! If necessary : service ndo2db restart service nagios restart 2.12 Poller: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Centreon Poller using Nagios engine to check hosts and services status and to send data to a Central. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 44 -

- 45 -

2.13

Poller: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 localhost poller000.localdomain.com poller000.localdomain.com central.localdomain.com

poller000 poller000 central

Switch to fixed IP address


vi /etc/network/interfaces

- 46 -

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.121 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

2.14

Poller: Necessary components

Run the followings: System update Once its installed, proceed to a system update
aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

- 47 -

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils libmysqlclient-dev -y

2.15

Poller: Nagios setup

/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

This must be the same nagios password of central


/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

- 48 -

2.16

Poller: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios nagios nagios nagios nagios nagios nagios nagios ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: /etc/init.d/nagios restart /etc/init.d/nagios stop /etc/init.d/nagios start /etc/init.d/nagios reload /usr/local/nagios/bin/nagiostats /usr/local/nagios/bin/nagios * /usr/local/nagios/bin/ndo2db * /usr/local/nagios/bin/ndomod.o *

User_Alias CENTREON=www-data,nagios Defaults:CENTREON !requiretty # Nagios Restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios* restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # CentStorage Restart CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart # CentStorage stop CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop # CentStorage start CENTREON ALL = NOPASSWD: /etc/init.d/centstorage start ## END: CENTREON SUDO

2.17

Poller: Ndoutils setup - 49 -

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

2.18

Poller: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.121'

Where 10.77.3.121 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source community

- 50 -

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

default default 127.0.0.1 192.168.0.0/24

public public public public private

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

2.19

Poller: Check services

sysv-rc-conf Check Nagios and snmpd to startup at 2,3,4 and 5 runlevel and reboot

- 51 -

2.20

Central: Add Poller to Central

Setting up key authentication using SSH On the central server generate a key pair using ssh-keygen. Accept all defaults (LEAVE BLANK PASSWORD).
root@central:/# cd /usr/local/nagios/libexec root@central:/usr/local/nagios/libexec# su nagios
$ ssh-keygen

- 52 -

Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: c3:27:df:68:67:ba:8a:60:1e:47:a1:8d:ad:ac:db:dc nagios@central The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | = o | | o + S . | | . o = o | | * . + + | | * = . . + | | o.+ E ..o. | +-----------------+

Transfer the public key to the satellite monitor for the Nagios daemon owner. (Replace {IP_ADDRESS} with the IP address of the satellite monitor.)
$ ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@poller000.localdomain.com The authenticity of host '10.77.0.49 (10.77.0.49)' can't be established. RSA key fingerprint is 5f:43:48:83:d0:42:eb:ab:42:08:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.77.0.49' (RSA) to the list of known hosts. nagios@10.77.0.49's password: Now try logging into the machine, with "ssh 'nagios@10.77.0.49'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.

The last command will ask for the password of nagios on the satellite monitor. If these steps are succesfully completed, you should be able to log on to the satellite monitor via SSH without entering a password. Verify that you could access to the satellite without password prompt:
ssh nagios@poller000.localdomain.com

From central centreon Synchronize commands with the satellite (only if you are using the same architecture on both side 32bits or 64bits):
scp /usr/local/nagios/libexec/* nagios@poller000.localdomain.com:/usr/local/nagios/libexec scp /usr/local/nagios/bin/ndomod.o nagios@poller000.localdomain.com:/usr/local/nagios/bin

if you encounter access denied errors like:


scp: /usr/local/nagios/libexec/check_dhcp: Permission denied

Delete files from satellite and resync again with scp. 2.21 Central: Add Poller to Centreon configuration

On the poller:
cd /usr/local/nagios/etc rm *

- 53 -

Connect to the Centreon interface and configure the satellite monitor.


Configuration > Centreon > Pollers > Add (Status: enabled, Localhost: no, IP address, etc.)

Next, duplicate the ndomod configuration for the new poller. Configuration > Centreon > ndomod.cfg. Select action "Duplicate". (Status: enabled, Requester: the name of the freshly created poller, IP address: the IP address of the central server, Instance name: must be unique)

Ndo2db not needed

- 54 -

Next, also duplicate the nagios configuration for the new poller. Configuration > Nagios > nagios.cfg Select action "Duplicate". (Status: enabled, Server Nagios configured: the name of the freshly created poller)

Finalization: Make sure centcore is running on the central server. If it is not running, start it: Reboot both central and poller Hosts configuration Finally, attach host/services to the new poller and generate the configuration for all servers, take a beer and watch your setup go.

Save and restart nagios Check ndo2db if communication is working:


root@central:/# netstat -apn |grep 5668 tcp 0 0 0.0.0.0:5668 0.0.0.0:* LISTEN 769/ndo2db

- 55 -

tcp tcp tcp

0 0 0

0 127.0.0.1:5668 0 10.77.3.120:5668 0 127.0.0.1:34227

127.0.0.1:34227 10.77.3.121:58976 127.0.0.1:5668

ESTABLISHED 2708/ndo2db ESTABLISHED 2719/ndo2db ESTABLISHED 2709/nagios

root@poller000:/# netstat -apn |grep 5668 tcp 0 0 0.0.0.0:5668 tcp 0 0 10.77.3.121:58976

0.0.0.0:* 10.77.3.120:5668

LISTEN 802/ndo2db ESTABLISHED 8976/nagios

- 56 -

3. Setup of a Central server with engine: Nagios, Broker: ndo2d, database: external MySql and setup of its Poller server with engine: Nagios using ndomod Now we start preparing an Ubuntu Server 10.04 system to become a mysql external database server for a Centreon Central server.

3.1

MySql: Ubuntu server setup Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 57 -

Choose only ssh server

3.2

MySql: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent:/home/cristian#

- 58 -

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent :/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 10.77.3.122 localhost mysql-cent.localdomain.com poller000.localdomain.com central.localdomain.com mysql-cent.localdomain.com

mysql-cent poller000 central mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.122 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

nameserver 10.77.3.0 nameserver 10.77.3.1 domain localdomain.com search localdomain.com Restart network services
cd /etc/init.d ./networking restart

- 59 -

3.3

MySql: Necessary components

System update Once its installed, proceed to a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils sysv-rc-conf policykit ntp -y

Apache2 and MySQL


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y

PhpMyAdmin
aptitude install phpmyadmin -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

3.4

MySql: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file: - 60 -

vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

3.5

MySql: Check services

sysv-rc-conf

- 61 -

Check Apache2, mysql, reboot

snmpd to startup at 2,3,4 and 5 runlevel and

3.6

MySql: Configure root user of mysql from any hosts

vi /etc/mysql/my.cnf bind-address = 10.77.3.122

root@mysql-cent:/etc/mysql# netstat -apn |grep 3306 tcp 0 0 10.77.3.122:3306 0.0.0.0:* 1080/mysqld

LISTEN

- 62 -

Change from:

To:

3.7

Central: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and ndo2db to send data to an external MySql database Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

- 63 -

- 64 -

3.8

Central: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012

- 65 -

System load: Usage of /: Memory usage: Swap usage:

0.15 10.8% of 7.49GB 5% 0%

Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 10.77.3.122 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com mysql-cent.localdomain.com

central central poller000 mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

3.9

Central: Necessary components

System update Once its installed, proceed with a system update

- 66 -

aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

3.10

Central: Nagios setup

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group. - 67 -

/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

3.11

Central: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

3.12

Central: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz

- 68 -

tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used:


ps f | grep ndo2db netstat -apn |grep 5668

3.13

Central: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

- 69 -

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

3.14

Central: Check services

Check that mysql is disabled and nagio nad ndo2db enabled.

- 70 -

3.15

Central: Install Centreon

Remember if you have not done before: - 71 -

export PATH="$PATH:/usr/local/nagios/bin/"

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y ------------------------------------------------------------------------

- 72 -

Start CentWeb Installation -----------------------------------------------------------------------Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory default to [/usr/local/nagios/etc]

OK

OK

OK OK OK

OK

OK

- 73 -

> Path /usr/local/nagios/etc Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl Change macros for dashboardBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 74 -

Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install -----------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php OK

- 75 -

Create /etc/centreon/instCentWeb.conf

OK

-----------------------------------------------------------------------Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin] >

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 76 -

Path /usr/local/centreon/bin /usr/bin/ssh /usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed

OK OK OK nagios nagios

OK OK OK OK OK

OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ Finding Nagios group : Finding Apache user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps Installing the plugins Trap binaries Change macros for snmptrapd.conf Change macros for snmptt.ini Install : snmptrapd.conf Install : snmp.conf Install : snmptt.ini Install : snmptt

OK nagios www-data

OK OK OK OK OK OK OK OK

- 77 -

Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ############################################################################### # # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start 3.16 Central: Finishing setup of Centreon

- 78 -

- 79 -

- 80 -

- 81 -

3.17

MySql: Configure centreon user of mysql from any hosts

Service centcore restart

- 82 -

Service centstorage restart

3.18

MySql: Reset admin password

Search for admin user of centreon in database and reset all informations

Insert this password: ( that is password)

5f4dcc3b5aa765d61d8327deb882cf99

- 83 -

3.19

Central: Configuring webinterface

Then enter centreon webinterface and retype the password for centreon user of mysql server in nd02db configuration:

- 84 -

Save configuration and reboot. 3.20 Poller: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Centreon Poller using Nagios engine to check hosts and services status and to send data to a Central using external MySql Database. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 85 -

- 86 -

3.21

Poller: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 localhost poller000.localdomain.com poller000.localdomain.com central.localdomain.com

poller000 poller000 central

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you): - 87 -

auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.121 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

3.22

Poller: Necessary components

Run the followings: System update Once its installed, proceed to a system update
aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl y

- 88 -

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils libmysqlclient-dev -y

3.23

Poller: Nagios setup

/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

This must be the same nagios password of central


/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

3.24

Poller: Nagios Plugins setup

cd /usr/local/src/

- 89 -

wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios nagios nagios nagios nagios nagios nagios nagios ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: /etc/init.d/nagios restart /etc/init.d/nagios stop /etc/init.d/nagios start /etc/init.d/nagios reload /usr/local/nagios/bin/nagiostats /usr/local/nagios/bin/nagios * /usr/local/nagios/bin/ndo2db * /usr/local/nagios/bin/ndomod.o *

User_Alias CENTREON=www-data,nagios Defaults:CENTREON !requiretty # Nagios Restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios* restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # CentStorage Restart CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart # CentStorage stop CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop # CentStorage start CENTREON ALL = NOPASSWD: /etc/init.d/centstorage start ## END: CENTREON SUDO

3.25

Poller: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz

- 90 -

cd ndoutils-1.4b9 wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

3.26

Poller: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.121'

Where 10.77.3.121 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default community public public

#com2sec paranoid com2sec readonly

- 91 -

com2sec readonly com2sec readonly

127.0.0.1 192.168.0.0/24

public public private

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

3.27

Poller: Check services

sysv-rc-conf Check Nagios and snmpd to startup at 2,3,4 and 5 runlevel and reboot

- 92 -

3.28

Central: Add Poller to Central

Setting up key authentication using SSH On the central server generate a key pair using ssh-keygen. Accept all defaults (LEAVE BLANK PASSWORD).
root@central:/# cd /usr/local/nagios/libexec root@central:/usr/local/nagios/libexec# su nagios

- 93 -

$ ssh-keygen

Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: c3:27:df:68:67:ba:8a:60:1e:47:a1:8d:ad:ac:db:dc nagios@central The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | = o | | o + S . | | . o = o | | * . + + | | * = . . + | | o.+ E ..o. | +-----------------+

Transfer the public key to the satellite monitor for the Nagios daemon owner. (Replace {IP_ADDRESS} with the IP address of the satellite monitor.)
$ ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@poller000.localdomain.com The authenticity of host '10.77.0.49 (10.77.0.49)' can't be established. RSA key fingerprint is 5f:43:48:83:d0:42:eb:ab:42:08:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.77.0.49' (RSA) to the list of known hosts. nagios@10.77.0.49's password: Now try logging into the machine, with "ssh 'nagios@10.77.0.49'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.

The last command will ask for the password of nagios on the satellite monitor. If these steps are succesfully completed, you should be able to log on to the satellite monitor via SSH without entering a password. Verify that you could access to the satellite without password prompt:
ssh nagios@poller000.localdomain.com

From central centreon Synchronize commands with the satellite (only if you are using the same architecture on both side 32bits or 64bits):
scp /usr/local/nagios/libexec/* nagios@poller000.localdomain.com:/usr/local/nagios/libexec scp /usr/local/nagios/bin/ndomod.o nagios@poller000.localdomain.com:/usr/local/nagios/bin

if you encounter access denied errors like:


scp: /usr/local/nagios/libexec/check_dhcp: Permission denied

Delete files from satellite and resync again with scp.

3.29

Central: Add Poller to Centreon configuration

- 94 -

On the poller:
cd /usr/local/nagios/etc rm *

Connect to the Centreon interface and configure the satellite monitor.


Configuration > Centreon > Pollers > Add (Status: enabled, Localhost: no, IP address, etc.)

Next, duplicate the ndomod configuration for the new poller. Configuration > Centreon > ndomod.cfg. Select action "Duplicate". (Status: enabled, Requester: the name of the freshly created poller, IP address: the IP address of the central server, Instance name: must be unique)

- 95 -

Ndo2db not needed

Next, also duplicate the nagios configuration for the new poller. Configuration > Nagios > nagios.cfg Select action "Duplicate". (Status: enabled, Server Nagios configured: the name of the freshly created poller)

Finalization: Make sure centcore is running on the central server. If it is not running, start it: Reboot both central and poller Hosts configuration Finally, attach host/services to the new poller and generate the configuration for all servers, take a beer and watch your setup go.

Save and restart nagios - 96 -

Check ndo2db if communication is working:

root@central:/# netstat -apn |grep 5668 tcp 0 0 0.0.0.0:5668 0.0.0.0:* LISTEN 769/ndo2db tcp 0 0 127.0.0.1:5668 127.0.0.1:34227 ESTABLISHED 2708/ndo2db tcp 0 0 10.77.3.120:5668 10.77.3.121:58976 ESTABLISHED 2719/ndo2db tcp 0 0 127.0.0.1:34227 127.0.0.1:5668 ESTABLISHED 2709/nagios root@poller000:/# netstat -apn |grep 5668 tcp 0 0 0.0.0.0:5668 0.0.0.0:* LISTEN 802/ndo2db tcp 0 0 10.77.3.121:58976 10.77.3.120:5668 ESTABLISHED 8976/nagios On the databse server: root@mysql-cent:~# netstat -apn | grep 3306 tcp 0 0 10.77.3.122:3306 0.0.0.0:* LISTEN 767/mysqld tcp 0 0 10.77.3.122:3306 10.77.3.120:52414 ESTABLISHED 767/mysqld tcp 0 0 10.77.3.122:3306 10.77.3.120:52519 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52448 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52416 ESTABLISHED 767/mysqld tcp 0 0 10.77.3.122:3306 10.77.3.120:52513 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52439 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52482 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52425 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52438 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52517 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52522 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52440 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52467 ESTABLISHED 767/mysqld tcp 0 0 10.77.3.122:3306 10.77.3.120:52524 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52480 TIME_WAIT tcp 0 0 10.77.3.122:3306 10.77.3.120:52462 TIME_WAIT we see that only connection from ndo2db from central are active. So ndomod.cfg of the poller is used to send data to ndo2db of the central that sends data to mysql server :

- 97 -

- 98 -

4. Setup of a Central server with engine: CentEngine, Broker: ndo2d, database: local MySql and setup of its Poller server with engine: Centengine 4.1 NOT WORKING YET

- 99 -

5. Setup of a Central server with engine: Nagios, Broker: Centreon-Broker, database: local MySql and setup of its Poller server with engine: Nagios, Broker: Centreon-Broker CentreonBroker's usage is pretty simple. But first let's have an overview of how the whole system works. As you might know (if not you probably wouldn't be here), the goal of Centreon Broker is to store Nagios events in a database. When monitoring services and hosts, Nagios generates differents kinds of events to notify if a check has been executed or if a service state has changed for example. Those events are processed internally by Nagios and cannot be exported by default. To do this, we will have to load a module within the Nagios process. Once loaded, the module will be able to convert Nagios event structures to a data stream (which is just raw data).

The next step is to retrieve the (potential multiple) data streams from the Nagios instance and store them in a database. Centreon Broker can listen on a or multiple sockets (IPv4, IPv6 or Unix) for a connection from the Nagios module. Each event data will be fetched and transfered to your favorite database.

- 100 -

5.1

Central: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and Centreon-Broker to send data its local MySql database. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

- 101 -

- 102 -

5.2

Central: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su

- 103 -

[sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com

central central poller000

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

5.3

Central: Necessary components

System update Once its installed, proceed with a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5 - 104 -

aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

5.4

Central: Nagios setup

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker

- 105 -

make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

5.5

Central: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

5.6

Central: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : - 106 -

After creating the binaries and libraries they have to be copied


cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used:


ps f | grep ndo2db netstat -apn |grep 5668

5.7

Central: Centreon-Broker setup

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous.

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

- 107 -

Building Centreon Broker Overview To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...). Dependencies In binary form Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Debian libqt4-dev Qt (>= 4.5) Ubuntu Red Hat qt4-devel Debian librrd-dev RRDTool development files Ubuntu Red Hat rrdtool-devel Software

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: - 108 -

tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build


cmake .

CMake will check for all necessary dependencies and indicates if they could not be found. Variables Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Description Base directory for Centreon Broker installation. If other prefixes are WITH_PREFIX expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed. Variable

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries - 109 -

Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

Packages Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite.

- 110 -

cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd root@central:/etc/init.d# chmod 777 central-broker root@central:/etc/init.d# chmod 777 central-rrd update-rc.d central-broker defaults update-rc.d central-rrd defaults chmod 777 R /var/run/centreon

5.8

Central: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

- 111 -

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

5.9

Central: Check services

sysv-rc-conf

- 112 -

Check Apche2, MySQL , Nagios , central-broker, central-rrd , snmpd to startup at 2,3,4 and 5 runlevel. NDO2DB must be disabled! And reboot

5.10

Central: Install Centreon

Remember if you have not done before:


export PATH="$PATH:/usr/local/nagios/bin/"

- 113 -

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y -----------------------------------------------------------------------Start CentWeb Installation ------------------------------------------------------------------------

- 114 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc

OK

OK

OK OK OK

OK

OK

OK

- 115 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl Change macros for dashboardBuilder.pl Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 116 -

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install -----------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK ------------------------------------------------------------------------

- 117 -

Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin /usr/bin/ssh OK OK

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 118 -

/usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed

OK nagios nagios

OK OK OK OK OK

OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ OK Finding Nagios group : nagios Finding Apache user : www-data Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps OK Installing the plugins Trap binaries OK Change macros for snmptrapd.conf OK Change macros for snmptt.ini OK Install : snmptrapd.conf OK Install : snmp.conf OK Install : snmptt.ini OK Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ###############################################################################

- 119 -

# # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start 5.11 Central: Finishing setup of Centreon

Connect via browser to http://yourcentral-ip/centreon

- 120 -

- 121 -

5.12

Central: Configuring Centreon to use Centreon-Broker

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

- 122 -

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

- 123 -

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

Name : Broker SQL DB Type : MySQL DB host : 127.0.0.1 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 127.0.0.1 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 127.0.0.1

- 124 -

Central-RRD

Complter longlet "General"

- 125 -

Name : Central-RRD Config file name : central-RRD.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

- 126 -

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 127 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 127.0.0.1

- 128 -

Modification Nagios
Pollers
Dans Configuration -> Centreon -> Pollers : Modifier les champs suivants :

Centreon Broker configuration path : /etc/centreon (l ou les fichiers .xml seront enregistr) Centreon Broker modules path : /usr/local/lib/centreon-broker/ (l ou se trouve les fichiers [0-9][0-9]-*.so)

Nagios.cfg
Dans Configuration -> Nagios -> nagios.cfg, Modifier les champs suivants :

Multiple Broker Module : /usr/local/lib/cbmod.so /etc/centreon/central-module.xml Broker Module Options : -1

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire : - 129 -

Configuration -> Nagios : Gnrer et Dplacer

reboot

Troubleshooting TODO Les commandes utiles :


ps axl | grep -E "cbd|mysql|cent|nagios" | grep -v grep

Permet de vrifier que tous les process de la chaine nagios -> mysql fonctionnent correctement
netstat -taupe | grep -E "cbd|mysql|cent|nagios" | grep -v grep

Permet de verifier que tous les communications dans la chaine nagios -> mysql fonctionnent correctement

5.13

Poller: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Centreon Poller using Nagios engine to check hosts and services status and to send data to a Central. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 130 -

- 131 -

5.14

Poller: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 localhost poller000.localdomain.com poller000.localdomain.com central.localdomain.com

poller000 poller000 central

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you): - 132 -

auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.121 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

5.15

Poller: Necessary components

Run the followings: System update Once its installed, proceed to a system update
aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP - 133 -

aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils libmysqlclient-dev -y

5.16

Poller: Nagios setup

/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

This must be the same nagios password of central


/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

- 134 -

5.17

Poller: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios nagios nagios nagios nagios nagios nagios nagios ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: /etc/init.d/nagios restart /etc/init.d/nagios stop /etc/init.d/nagios start /etc/init.d/nagios reload /usr/local/nagios/bin/nagiostats /usr/local/nagios/bin/nagios * /usr/local/nagios/bin/ndo2db * /usr/local/nagios/bin/ndomod.o *

User_Alias CENTREON=www-data,nagios Defaults:CENTREON !requiretty # Nagios Restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios* restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # CentStorage Restart CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart # CentStorage stop CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop # CentStorage start CENTREON ALL = NOPASSWD: /etc/init.d/centstorage start ## END: CENTREON SUDO

5.18

Poller: Ndoutils setup

cd /usr/local/src

- 135 -

wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

5.19

Poller: Centreon-Broker setup

Remember to allow remote connection in mysql server; and allow centreon user of mysql from any hosts!!!

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous. - 136 -

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

Building Centreon Broker

Overview
To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...).

Dependencies
In binary form
Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Debian libqt4-dev Qt (>= 4.5) Ubuntu Red Hat qt4-devel Debian librrd-dev RRDTool development files Ubuntu Red Hat rrdtool-devel Software

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev cd etc mkdir centreon

- 137 -

chmod 777 R centreon

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build
cmake .

CMake will check for all necessary dependencies and indicates if they could not be found.

Variables
Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Description Base directory for Centreon Broker installation. If other prefixes are WITH_PREFIX expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed. Variable

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

- 138 -

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

Packages
Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite.

- 139 -

cd /usr/local/src/centreon-broker-2.0.1/script cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd

modify the /etc/init.d/central-broker and the /etc/init.d/central-rrd as follow: from RunDir=/var/run/centreon to RunDir=/var/run cd /etc/init.d chmod 777 central-broker chmod 777 central-rrd

update-rc.d central-broker defaults update-rc.d central-rrd defaults

cd /etc/ mkdir centreon chmod 777 R centreon cd /usr/local mkdir centreon cd centreon mkdir log cd /usr/local chmod 777 R centreon cd /var/lib/centreon mkdir metrics mkdir status cd /var/lib/

- 140 -

chmod 777 R centreon

cd /usr/local/centreon/log mkdir centreon-broker chmod 777 R centreon-broker

5.20

Poller: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.121'

Where 10.77.3.121 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

- 141 -

5.21

Poller: Check services

sysv-rc-conf

Check Nagios and snmpd to startup at 2,3,4 and 5 runlevel and reboot

- 142 -

5.22

Central: Add Poller to Central

Setting up key authentication using SSH On the central server generate a key pair using ssh-keygen. Accept all defaults (LEAVE BLANK PASSWORD).
root@central:/# cd /usr/local/nagios/libexec root@central:/usr/local/nagios/libexec# su nagios
$ ssh-keygen

Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: c3:27:df:68:67:ba:8a:60:1e:47:a1:8d:ad:ac:db:dc nagios@central The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | = o | | o + S . | | . o = o | | * . + + | | * = . . + | | o.+ E ..o. | +-----------------+

Transfer the public key to the satellite monitor for the Nagios daemon owner. (Replace {IP_ADDRESS} with the IP address of the satellite monitor.)
$ ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@poller000.localdomain.com The authenticity of host '10.77.0.49 (10.77.0.49)' can't be established. RSA key fingerprint is 5f:43:48:83:d0:42:eb:ab:42:08:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.77.0.49' (RSA) to the list of known hosts. nagios@10.77.0.49's password: Now try logging into the machine, with "ssh 'nagios@10.77.0.49'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.

The last command will ask for the password of nagios on the satellite monitor. If these steps are succesfully completed, you should be able to log on to the satellite monitor via SSH without entering a password. Verify that you could access to the satellite without password prompt:
ssh nagios@poller000.localdomain.com

From central centreon Synchronize commands with the satellite (only if you are using the same architecture on both side 32bits or 64bits):
scp /usr/local/nagios/libexec/* nagios@poller000.localdomain.com:/usr/local/nagios/libexec

- 143 -

scp /usr/local/nagios/bin/ndomod.o nagios@poller000.localdomain.com:/usr/local/nagios/bin

if you encounter access denied errors like:


scp: /usr/local/nagios/libexec/check_dhcp: Permission denied

Delete files from satellite and resync again with scp.

5.23

Central: Add Poller to Centreon configuration

On the poller:
cd /usr/local/nagios/etc rm *

Duplicate Poller cfg:

Duplicate nagios.cfg:

- 144 -

5.24

Central: Configuring Centreon to let the Poller use Centreon-Broker

Dsactivation de NDO
Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg - 145 -

Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4" - 146 -

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

- 147 -

Name : Broker SQL DB Type : MySQL DB host : 10.77.3.120 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 10.77.3.120 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 10.77.3.120

- 148 -

Central-RRD

Complter longlet "General"

- 149 -

Name : Central-RRD Config file name : central-RRD.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

- 150 -

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 151 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 10.77.3.120

- 152 -

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire :

Configuration -> Nagios : Gnrer et Dplacer

reboot

- 153 -

6. Setup of a Central server with engine: Nagios, Broker: Centreon-Broker, database: external MySql and setup of its Poller server with engine: Nagios, Broker: Centreon-Broker 6.1 MySql: Ubuntu server setup Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 154 -

Choose only ssh server

6.2

MySql: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent:/home/cristian#

Setup root password - 155 -

Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent :/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 10.77.3.122 localhost mysql-cent.localdomain.com poller000.localdomain.com central.localdomain.com mysql-cent.localdomain.com

mysql-cent poller000 central mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.122 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

nameserver 10.77.3.0 nameserver 10.77.3.1 domain localdomain.com search localdomain.com Restart network services
cd /etc/init.d ./networking restart

- 156 -

6.3

MySql: Necessary components

System update Once its installed, proceed to a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils sysv-rc-conf policykit ntp -y

Apache2 and MySQL


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y

PhpMyAdmin
aptitude install phpmyadmin -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

6.4

MySql: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file: - 157 -

vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

6.5

MySql: Check services

sysv-rc-conf

- 158 -

Check Apache2, mysql, reboot

snmpd to startup at 2,3,4 and 5 runlevel and

6.6

MySql: Configure root user of mysql from any hosts

vi /etc/mysql/my.cnf bind-address = 10.77.3.122

root@mysql-cent:/etc/mysql# netstat -apn |grep 3306 tcp 0 0 10.77.3.122:3306 0.0.0.0:* 1080/mysqld

LISTEN

- 159 -

Change from:

To:

6.7

Central: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and Centreon Broker to send data to an external MySql database Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

- 160 -

- 161 -

6.8

Central: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012

- 162 -

System load: Usage of /: Memory usage: Swap usage:

0.15 10.8% of 7.49GB 5% 0%

Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 10.77.3.122 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com mysql-cent.localdomain.com

central central poller000 mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

6.9

Central: Necessary components

System update Once its installed, proceed with a system update

- 163 -

aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

6.10

Central: Nagios setup

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group. - 164 -

/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

6.11

Central: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

6.12

Central: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz

- 165 -

tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used:


ps f | grep ndo2db netstat -apn |grep 5668

6.13

Central: Centreon-Broker setup

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

- 166 -

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous.

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

Building Centreon Broker Overview To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...). Dependencies In binary form Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Qt (>= 4.5) Debian libqt4-dev Ubuntu - 167 Software

RRDTool development files

Red Hat Debian Ubuntu Red Hat

qt4-devel librrd-dev rrdtool-devel

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build
cmake .

CMake will check for all necessary dependencies and indicates if they could not be found. Variables Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Description Base directory for Centreon Broker installation. If other prefixes are WITH_PREFIX expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed. Variable

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

- 168 -

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

Packages Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite. - 169 -

cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd root@central:/etc/init.d# chmod 777 central-broker root@central:/etc/init.d# chmod 777 central-rrd update-rc.d central-broker defaults update-rc.d central-rrd defaults chmod 777 R /var/run/centreon

6.14

Central: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

- 170 -

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

6.15

Central: Check services

sysv-rc-conf

- 171 -

Check Apche2, MySQL , Nagios , central-broker, central-rrd , snmpd to startup at 2,3,4 and 5 runlevel. NDO2DB must be disabled! And reboot

6.16

Central: Install Centreon

Remember if you have not done before:


export PATH="$PATH:/usr/local/nagios/bin/"

- 172 -

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y -----------------------------------------------------------------------Start CentWeb Installation ------------------------------------------------------------------------

- 173 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc

OK

OK

OK OK OK

OK

OK

OK

- 174 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl Change macros for dashboardBuilder.pl Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 175 -

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install -----------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK ------------------------------------------------------------------------

- 176 -

Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin /usr/bin/ssh OK OK

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 177 -

/usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed

OK nagios nagios

OK OK OK OK OK

OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ OK Finding Nagios group : nagios Finding Apache user : www-data Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps OK Installing the plugins Trap binaries OK Change macros for snmptrapd.conf OK Change macros for snmptt.ini OK Install : snmptrapd.conf OK Install : snmp.conf OK Install : snmptt.ini OK Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ###############################################################################

- 178 -

# # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start

6.17

Central: Finishing setup of Centreon

- 179 -

- 180 -

- 181 -

- 182 -

6.18

MySql: Configure centreon user of mysql from any hosts

Service centcore restart

- 183 -

Service centstorage restart

6.19

MySql: Reset admin password

Search for admin user of centreon in database and reset all informations

Insert this password: ( that is password)

5f4dcc3b5aa765d61d8327deb882cf99

- 184 -

6.20

Central: Configuring Centreon to use Centreon-Broker

cd /usr/local/centreon/log mkdir centreon-broker chmod 777 R centreon-broker

Dsactivation de NDO

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker

- 185 -

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

- 186 -

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

Name : Broker SQL DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 - 187 -

DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 127.0.01

- 188 -

Central-RRD

Complter longlet "General"

- 189 -

Name : Central-RRD Config file name : central-rrd.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

- 190 -

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 191 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 127.0.0.1

- 192 -

Modification Nagios
Pollers
Dans Configuration -> Centreon -> Pollers : Modifier les champs suivants :

Centreon Broker configuration path : /etc/centreon (l ou les fichiers .xml seront enregistr) Centreon Broker modules path : /usr/local/lib/centreon-broker/ (l ou se trouve les fichiers [0-9][0-9]-*.so)

Nagios.cfg
Dans Configuration -> Nagios -> nagios.cfg, Modifier les champs suivants :

Multiple Broker Module : /usr/local/lib/cbmod.so /etc/centreon/central-module.xml Broker Module Options : -1

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire : - 193 -

Configuration -> Nagios : Gnrer et Dplacer

Init script
TODO

Debian
Les init script sont dans /script. (redhat-init.d-broker.sh et/ou redhat-init.d-rrd.sh) Ils se dupliquent et les lignes de config son en ligne 99 -> 102

reboot

6.21

Poller: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Centreon Poller using Nagios engine to check hosts and services status and to send data to a MySql Server via centreon broker. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 194 -

6.22

Poller: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012

- 195 -

System load: Usage of /: Memory usage: Swap usage:

0.15 10.8% of 7.49GB 5% 0%

Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 localhost poller000.localdomain.com poller000.localdomain.com central.localdomain.com

poller000 poller000 central

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.121 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

6.23

Poller: Necessary components

Run the followings: - 196 -

System update Once its installed, proceed to a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils libmysqlclient-dev -y

6.24

Poller: Nagios setup

/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

This must be the same nagios password of central


/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios

- 197 -

/usr/sbin/usermod -a -G nagios www-data cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

6.25

Poller: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios nagios nagios nagios nagios ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: /etc/init.d/nagios restart /etc/init.d/nagios stop /etc/init.d/nagios start /etc/init.d/nagios reload /usr/local/nagios/bin/nagiostats

- 198 -

nagios nagios nagios

ALL=NOPASSWD: /usr/local/nagios/bin/nagios * ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db * ALL=NOPASSWD: /usr/local/nagios/bin/ndomod.o *

User_Alias CENTREON=www-data,nagios Defaults:CENTREON !requiretty # Nagios Restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios* restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # CentStorage Restart CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart # CentStorage stop CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop # CentStorage start CENTREON ALL = NOPASSWD: /etc/init.d/centstorage start ## END: CENTREON SUDO

6.26

Poller: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ *

- 199 -

chown nagios:nagios /usr/local/nagios/bin/ndo*

6.27

Poller: Centreon-Broker setup

Remember to allow remote connection in mysql server; and allow centreon user of mysql from any hosts!!!

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous.

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

Building Centreon Broker

Overview
To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...).

- 200 -

Dependencies
In binary form
Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Debian libqt4-dev Qt (>= 4.5) Ubuntu Red Hat qt4-devel Debian librrd-dev RRDTool development files Ubuntu Red Hat rrdtool-devel Software

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev cd etc mkdir centreon chmod 777 R centreon

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build
cmake .

CMake will check for all necessary dependencies and indicates if they could not be found.

- 201 -

Variables
Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Description Base directory for Centreon Broker installation. If other prefixes are WITH_PREFIX expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed. Variable

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

- 202 -

Packages
Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite.

cd /usr/local/src/centreon-broker-2.0.1/script cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd

- 203 -

modify the /etc/init.d/central-broker and the /etc/init.d/central-rrd as follow: from RunDir=/var/run/centreon to RunDir=/var/run cd /etc/init.d chmod 777 central-broker chmod 777 central-rrd

update-rc.d central-broker defaults update-rc.d central-rrd defaults

cd /etc/ mkdir centreon chmod 777 R centreon cd /usr/local mkdir centreon cd centreon mkdir log cd /usr/local chmod 777 R centreon cd /var/lib/centreon mkdir metrics mkdir status cd /var/lib/ chmod 777 R centreon

cd /usr/local/centreon/log mkdir centreon-broker chmod 777 R centreon-broker

6.28

Poller: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.121'

Where 10.77.3.121 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

- 204 -

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

6.29

Poller: Check services

sysv-rc-conf

- 205 -

Check Nagios and snmpd to startup at 2,3,4 and 5 runlevel and reboot

- 206 -

6.30

Central: Add Poller to Central

Setting up key authentication using SSH On the central server generate a key pair using ssh-keygen. Accept all defaults (LEAVE BLANK PASSWORD).
root@central:/# cd /usr/local/nagios/libexec root@central:/usr/local/nagios/libexec# su nagios
$ ssh-keygen

Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: c3:27:df:68:67:ba:8a:60:1e:47:a1:8d:ad:ac:db:dc nagios@central The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | = o | | o + S . | | . o = o | | * . + + | | * = . . + | | o.+ E ..o. | +-----------------+

Transfer the public key to the satellite monitor for the Nagios daemon owner. (Replace {IP_ADDRESS} with the IP address of the satellite monitor.)
$ ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@poller000.localdomain.com The authenticity of host '10.77.0.49 (10.77.0.49)' can't be established. RSA key fingerprint is 5f:43:48:83:d0:42:eb:ab:42:08:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.77.0.49' (RSA) to the list of known hosts. nagios@10.77.0.49's password: Now try logging into the machine, with "ssh 'nagios@10.77.0.49'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.

The last command will ask for the password of nagios on the satellite monitor. If these steps are succesfully completed, you should be able to log on to the satellite monitor via SSH without entering a password. Verify that you could access to the satellite without password prompt:
ssh nagios@poller000.localdomain.com

From central centreon Synchronize commands with the satellite (only if you are using the same architecture on both side 32bits or 64bits):
scp /usr/local/nagios/libexec/* nagios@poller000.localdomain.com:/usr/local/nagios/libexec

- 207 -

scp /usr/local/nagios/bin/ndomod.o nagios@poller000.localdomain.com:/usr/local/nagios/bin

if you encounter access denied errors like:


scp: /usr/local/nagios/libexec/check_dhcp: Permission denied

Delete files from satellite and resync again with scp.

6.31

Central: Add Poller to Centreon configuration

On the poller:
cd /usr/local/nagios/etc rm *

Duplicate Poller cfg:

Duplicate nagios.cfg:

- 208 -

6.32

Central: Configuring Centreon to let the Poller use Centreon-Broker

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker - 209 -

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

- 210 -

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

- 211 -

Name : Broker SQL DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 127.0.0.1

- 212 -

Central-RRD

Complter longlet "General"

- 213 -

Name : Central-RRD Config file name : central-RRD.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

- 214 -

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 215 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 127.0.0.1

- 216 -

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire :

Configuration -> Nagios : Gnrer et Dplacer

reboot

- 217 -

7. Setup of two Central server with engine: Nagios, Broker: Centreon-Broker, database: external MySql and setup of a Poller server with engine: Nagios, Broker: Centreon-Broker 7.1 MySql: Ubuntu server setup Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 218 -

Choose only ssh server

7.2

MySql: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012 System load: Usage of /: Memory usage: Swap usage: 0.15 10.8% of 7.49GB 5% 0% Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent:/home/cristian#

Setup root password - 219 -

Last login: Mon Jan 30 11:09:51 2012 cristian@ mysql-cent:~$ sudo su [sudo] password for cristian: root@ mysql-cent :/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 10.77.3.122 localhost mysql-cent.localdomain.com poller000.localdomain.com central.localdomain.com mysql-cent.localdomain.com

mysql-cent poller000 central mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.122 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

nameserver 10.77.3.0 nameserver 10.77.3.1 domain localdomain.com search localdomain.com Restart network services
cd /etc/init.d ./networking restart

- 220 -

7.3

MySql: Necessary components

System update Once its installed, proceed to a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils sysv-rc-conf policykit ntp -y

Apache2 and MySQL


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y

PhpMyAdmin
aptitude install phpmyadmin -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

7.4

MySql: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file: - 221 -

vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

7.5

MySql: Check services

sysv-rc-conf

- 222 -

Check Apache2, mysql, reboot

snmpd to startup at 2,3,4 and 5 runlevel and

7.6

MySql: Configure root user of mysql from any hosts

vi /etc/mysql/my.cnf bind-address = 10.77.3.122

root@mysql-cent:/etc/mysql# netstat -apn |grep 3306 tcp 0 0 10.77.3.122:3306 0.0.0.0:* 1080/mysqld

LISTEN

- 223 -

Change from:

To:

7.7

Central1: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Central Centreon using Nagios engine to check hosts and services status and Centreon Broker to send data to an external MySql database Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created cristian/password ( sudo password = password).

- 224 -

- 225 -

7.8

Central1: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012

- 226 -

System load: Usage of /: Memory usage: Swap usage:

0.15 10.8% of 7.49GB 5% 0%

Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.120 10.77.3.121 10.77.3.122 localhost central.localdomain.com central.localdomain.com poller000.localdomain.com mysql-cent.localdomain.com

central central poller000 mysql-cent

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.120 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

7.9

Central1: Necessary components

System update Once its installed, proceed with a system update

- 227 -

aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

Web and php5


aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmysqlclient-dev -y aptitude install php-pear php5-ldap php5-snmp php5-gd -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl snmptrapfmt snmptt -y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils -y

7.10

Central1: Nagios setup

Create nagios user


/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios (remember this password for future poller setup)

On older Ubuntu server editions you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu. Create a new nagios group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group. - 228 -

/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

7.11

Central1: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install

7.12

Central1: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz

- 229 -

tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios Make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

make ndo2db daemon autorun Install the ndo init script by copying it from the ndoutils to the init directory and making it executable by running
cd /usr/local/src/ndoutils-1.4b9 cp daemon-init /etc/init.d/ndo2db chmod +x /etc/init.d/ndo2db

Then add it to your init runlevel to load it automatically when starting/restarting your server. For Debian/Ubuntu do as root or with sudo:
update-rc.d ndo2db defaults

Check if process is running and if tcp port is being used:


ps f | grep ndo2db netstat -apn |grep 5668

7.13

Central1: Centreon-Broker setup

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

- 230 -

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous.

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

Building Centreon Broker Overview To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...). Dependencies In binary form Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Qt (>= 4.5) Debian libqt4-dev Ubuntu - 231 Software

RRDTool development files

Red Hat Debian Ubuntu Red Hat

qt4-devel librrd-dev rrdtool-devel

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build
cmake .

CMake will check for all necessary dependencies and indicates if they could not be found. Variables Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Description Base directory for Centreon Broker installation. If other prefixes are WITH_PREFIX expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed. Variable

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

- 232 -

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

Packages Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite. - 233 -

cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd root@central:/etc/init.d# chmod 777 central-broker root@central:/etc/init.d# chmod 777 central-rrd update-rc.d central-broker defaults update-rc.d central-rrd defaults chmod 777 R /var/run/centreon

7.14

Central1: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.120'

Where 10.77.3.120 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

- 234 -

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 192.168.0.0/24 community public public public public private

#com2sec paranoid com2sec readonly com2sec readonly com2sec readonly

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

7.15

Central1: Check services

sysv-rc-conf

- 235 -

Check Apche2, MySQL , Nagios , central-broker, central-rrd , snmpd to startup at 2,3,4 and 5 runlevel. NDO2DB must be disabled! And reboot

7.16

Central1: Install Centreon

Remember if you have not done before:


export PATH="$PATH:/usr/local/nagios/bin/"

- 236 -

Then follow these steps


cd /usr/local/src wget http://download.centreon.com/centreon/centreon-2.3.4.tar.gz tar -xzf centreon-2.3.4.tar.gz cd centreon-2.3.4 ./install.sh i

############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.3 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue.

Do you accept GPL license ? [y/n], default to [n]: >y -----------------------------------------------------------------------Please choose what you want to install -----------------------------------------------------------------------Do you want to install : Centreon Web Front [y/n], default to [n]: > y Do you want to install : Centreon CentCore [y/n], default to [n]: > y Do you want to install : Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install : Centreon Snmp Traps process [y/n], default to [n]: > y -----------------------------------------------------------------------Start CentWeb Installation ------------------------------------------------------------------------

- 237 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/local/centreon] [y/n], default to [n]: > y Path /usr/local/centreon OK Where is your Centreon log directory default to [/usr/local/centreon/log] > Do you want me to create this directory ? [/usr/local/centreon/log] [y/n], default to [n]: > y Path /usr/local/centreon/log OK Where is your Centreon etc directory default to [/etc/centreon] >y You select slash... Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon Where is your Centreon variable library directory? default to [/var/lib/centreon] > Do you want me to create this directory ? [/var/lib/centreon] [y/n], default to [n]: > y Path /var/lib/centreon OK Where is your CentPlugins Traps binary default to [/usr/local/centreon/bin] > Do you want me to create this directory ? [/usr/local/centreon/bin] [y/n], default to [n]: > y Path /usr/local/centreon/bin OK Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > Path /usr/lib/perl5 /usr/bin/rrdtool /usr/bin/mail Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc

OK

OK

OK OK OK

OK

OK

OK

- 238 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec /usr/local/nagios/bin//nagios Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos /usr/local/nagios/bin//nagiostats p1_file : /usr/local/nagios/bin/p1.pl /usr/bin/php /usr/bin/perl Finding Apache group : Finding Apache user : Finding Nagios user : Finding Nagios group : /usr/local/nagios/bin//ndomod.o

OK

OK OK

OK OK OK OK OK www-data www-data nagios nagios OK

-----------------------------------------------------------------------Configure Sudo -----------------------------------------------------------------------Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers Nagios init script Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo

OK OK

OK

-----------------------------------------------------------------------Configure Apache server -----------------------------------------------------------------------Do you want to add Centreon Apache sub configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service Preparing Centreon temporary files Change right on /usr/local/centreon/log Change right on /etc/centreon Change right on /usr/local/nagios/share/images/logos Install nagios documentation Change macros for insertBaseConf.sql Change macros for php files Change right on /usr/local/nagios/etc Copy CentWeb in system directory Install CentWeb (web front of centreon) Install libraries Copying libinstall Change macros for centreon.cron Install Centreon cron.d file Change macros for centAcl.php Change macros for downtimeManager.php Change macros for eventReportBuilder.pl Change macros for dashboardBuilder.pl Install cron directory Change right for eventReportBuilder.pl Change right for dashboardBuilder.pl

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

- 239 -

-----------------------------------------------------------------------Pear Modules -----------------------------------------------------------------------Check PEAR modules PEAR 1.4.9 1.9.0 OK DB 1.7.6 NOK DB_DataObject 1.8.4 NOK DB_DataObject_FormBuilder 1.0.0RC4 NOK MDB2 2.0.0 NOK Date 1.4.6 NOK HTML_Common 1.2.2 NOK HTML_QuickForm 3.2.5 NOK HTML_QuickForm_advmultiselect 1.1.0 NOK HTML_Table 1.6.1 NOK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 NOK Net_Socket 1.0.1 NOK Net_Traceroute 0.21 NOK Net_Ping 2.4.1 NOK Validate 0.6.2 NOK XML_RPC 1.4.5 NOK SOAP 0.10.1 NOK Log 1.9.11 NOK Do you want me to install/upgrade your PEAR modules [y/n], default to [y]: > y Upgrading PEAR modules Installing PEAR modules DB DB_DataObject DB_DataObject_FormBuilder MDB2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL Net_SMTP Net_Traceroute Net_Ping Validate XML_RPC SOAP Log Check PEAR modules PEAR DB DB_DataObject DB_DataObject_FormBuilder MDB2 Date HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Archive_Tar Auth_SASL Console_Getopt Net_SMTP Net_Socket Net_Traceroute Net_Ping Validate XML_RPC SOAP Log All PEAR modules

1.7.6 1.8.4 1.0.0RC4 2.0.0 1.1.0 1.6.1 1.0.1 1.2.8 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11 1.4.9 1.7.6 1.8.4 1.0.0RC4 2.0.0 1.4.6 1.2.2 3.2.5 1.1.0 1.6.1 1.1 1.0.1 1.2 1.2.8 1.0.1 0.21 2.4.1 0.6.2 1.4.5 0.10.1 1.9.11

1.7.14 1.9.6 1.0.1 2.4.1 1.5.1 1.8.3 1.0.6 1.6.1 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7 1.9.4 1.7.14 1.9.6 1.0.1 2.4.1 1.4.7 1.2.5 3.2.13 1.5.1 1.8.3 1.3.3 1.0.6 1.2.3 1.6.1 1.0.10 0.21.3 2.4.5 0.8.5 1.5.5 0.13.0 1.12.7

OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

-----------------------------------------------------------------------Centreon Post Install -----------------------------------------------------------------------Create /usr/local/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK ------------------------------------------------------------------------

- 240 -

Start CentStorage Installation -----------------------------------------------------------------------Where is your Centreon Run Dir directory? default to [/var/run/centreon] > Do you want me to create this directory ? [/var/run/centreon] [y/n], default to [n]: > y Path /var/run/centreon OK Where is your CentStorage binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql Creating Centreon Directory '/var/lib/centreon/status' Creating Centreon Directory '/var/lib/centreon/metrics' Change macros for centstorage binary Install CentStorage binary Install library for centstorage Change right : /var/run/centreon Change macros for centstorage init script Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstorage /etc/rc1.d/K30centstorage -> ../init.d/centstorage /etc/rc6.d/K30centstorage -> ../init.d/centstorage /etc/rc2.d/S40centstorage -> ../init.d/centstorage /etc/rc3.d/S40centstorage -> ../init.d/centstorage /etc/rc4.d/S40centstorage -> ../init.d/centstorage /etc/rc5.d/S40centstorage -> ../init.d/centstorage Configuration file /etc/centreon/conf.pm not found. Exiting. CentStorage stop FAIL Change macros for logAnalyser OK Install logAnalyser OK Change macros for nagiosPerfTrace OK Install nagiosPerfTrace OK Change macros for purgeLogs OK Install purgeLogs OK Change macros for purgeCentstorage OK Install purgeCentstorage OK Change macros for centreonPurge.sh OK Install centreonPurge.sh OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -----------------------------------------------------------------------Start CentCore Installation -----------------------------------------------------------------------Where is your CentCore binary directory default to [/usr/local/centreon/bin] > Path /usr/local/centreon/bin /usr/bin/ssh OK OK

OK

OK nagios nagios

OK OK OK OK OK OK OK OK

OK

- 241 -

/usr/bin/scp Finding Nagios group : Finding Nagios user : Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change CentCore Macro Copy CentCore in binary directory Change right : /var/run/centreon Change right : /var/lib/centreon Replace CentCore init script Macro Do you want me to install CentCore init script ? [y/n], default to [n]: >y CentCore init script installed

OK nagios nagios

OK OK OK OK OK

OK

Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: warning: /etc/init.d/centcore missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> Adding system startup for /etc/init.d/centcore ... /etc/rc0.d/K30centcore -> ../init.d/centcore /etc/rc1.d/K30centcore -> ../init.d/centcore /etc/rc6.d/K30centcore -> ../init.d/centcore /etc/rc2.d/S40centcore -> ../init.d/centcore /etc/rc3.d/S40centcore -> ../init.d/centcore /etc/rc4.d/S40centcore -> ../init.d/centcore /etc/rc5.d/S40centcore -> ../init.d/centcore Create /etc/centreon/instCentCore.conf OK -----------------------------------------------------------------------Start CentPlugins Installation -----------------------------------------------------------------------Where is your CentPlugins lib directory default to [/var/lib/centreon/centplugins] > Do you want me to create this directory ? [/var/lib/centreon/centplugins] [y/n], default to [n]: > y Path /var/lib/centreon/centplugins OK Finding Nagios user : nagios Finding Nagios group : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPlugins OK Installing the plugins OK Change right on centreon.conf OK CentPlugins is installed -----------------------------------------------------------------------Start CentPlugins Traps Installation -----------------------------------------------------------------------Where is your SNMP configuration directory default to [/etc/snmp] > Where is your SNMPTT binaries directory default to [/usr/local/centreon/bin/] > /usr/local/centreon/bin/ OK Finding Nagios group : nagios Finding Apache user : www-data Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for CentPluginsTraps OK Installing the plugins Trap binaries OK Change macros for snmptrapd.conf OK Change macros for snmptt.ini OK Install : snmptrapd.conf OK Install : snmp.conf OK Install : snmptt.ini OK Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ###############################################################################

- 242 -

# # # Go to the URL : http://central.domain.com/centreon/ # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------# # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################

Remember these settings:


chmod 777 -R /usr/local/centreon/log chmod 777 R /var/run/centreon chmod 777 -R /usr/local/nagios/var cd /usr/local/nagios/libexec chmod 777 process-service-perfdata chown nagios:www-data process-service-perfdata

or services centcore and censtorage wont start

7.17

Central1: Finishing setup of Centreon

- 243 -

- 244 -

- 245 -

- 246 -

7.18

MySql: Configure centreon user of mysql from any hosts

Service centcore restart

- 247 -

Service centstorage restart

7.19

MySql: Reset admin password

Search for admin user of centreon in database and reset all informations

Insert this password: ( that is password)

5f4dcc3b5aa765d61d8327deb882cf99

- 248 -

7.20

Central1: Configuring Centreon to use Centreon-Broker

cd /usr/local/centreon/log mkdir centreon-broker chmod 777 R centreon-broker

Dsactivation de NDO

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker

- 249 -

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

- 250 -

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

Name : Broker SQL DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 - 251 -

DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 127.0.01

- 252 -

Central-RRD

Complter longlet "General"

- 253 -

Name : Central-RRD Config file name : central-rrd.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

- 254 -

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 255 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 127.0.0.1

- 256 -

Modification Nagios
Pollers
Dans Configuration -> Centreon -> Pollers : Modifier les champs suivants :

Centreon Broker configuration path : /etc/centreon (l ou les fichiers .xml seront enregistr) Centreon Broker modules path : /usr/local/lib/centreon-broker/ (l ou se trouve les fichiers [0-9][0-9]-*.so)

Nagios.cfg
Dans Configuration -> Nagios -> nagios.cfg, Modifier les champs suivants :

Multiple Broker Module : /usr/local/lib/cbmod.so /etc/centreon/central-module.xml Broker Module Options : -1

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire : - 257 -

Configuration -> Nagios : Gnrer et Dplacer

Init script
TODO

Debian
Les init script sont dans /script. (redhat-init.d-broker.sh et/ou redhat-init.d-rrd.sh) Ils se dupliquent et les lignes de config son en ligne 99 -> 102

reboot

7.21

Poller: Ubuntu server setup

Now we start preparing an Ubuntu Server 10.04 system to become a Centreon Poller using Nagios engine to check hosts and services status and to send data to a MySql Server via centreon broker. Start with ubuntu-10.04.3-server-amd64.iso a default system setup. User created Cristian/password ( sudo password = password).

- 258 -

7.22

Poller: First login

Login and become root:


login as: cristian cristian@10.77.0.83's password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux Ubuntu 10.04.3 LTS Welcome to the Ubuntu Server! * Documentation: http://www.ubuntu.com/server/doc System information as of Mon Jan 30 11:10:17 CET 2012

- 259 -

System load: Usage of /: Memory usage: Swap usage:

0.15 10.8% of 7.49GB 5% 0%

Processes: 73 Users logged in: 1 IP address for eth0: 10.77.0.83

Graph this data and manage this system at https://landscape.canonical.com/ 0 packages can be updated. 0 updates are security updates. Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian#

Setup root password


Last login: Mon Jan 30 11:09:51 2012 cristian@central:~$ sudo su [sudo] password for cristian: root@central:/home/cristian# passwd vi /etc/hosts 127.0.0.1 127.0.1.1 10.77.3.121 10.77.3.120 localhost poller000.localdomain.com poller000.localdomain.com central.localdomain.com

poller000 poller000 central

Switch to fixed IP address


vi /etc/network/interfaces

Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto lo iface lo inet loopback # The primary network interface auto eth0 # iface eth0 inet dhcp iface eth0 inet static address 10.77.3.121 netmask 255.255.252.0 network 10.77.0.0 broadcast 10.77.3.255 gateway 10.77.2.255

Modify also resolv.conf to set dns server


vi /etc/resolv.conf

Restart network services


cd /etc/init.d ./networking restart

7.23

Poller: Necessary components

Run the followings: System update - 260 -

Once its installed, proceed to a system update


aptitude update sudo aptitude full-upgrade y

Compilation component install


aptitude install build-essential y aptitude install linux-headers-$(uname -r) -y

The headers should be already present. If you are using a virtual machine, its time to install the appropriate tools (its up to you). System
aptitude install sysutils policykit ntp -y

RRDTool
aptitude install rrdtool librrds-perl -y

Perl
aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP
aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl y

GD-Libraries
aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev y

Other needed library


aptitude install libldap2-dev libssl-dev libsnmp-dev sysv-rc-conf dnsutils libmysqlclient-dev -y

7.24

Poller: Nagios setup

/usr/sbin/useradd -m -s /bin/bash nagios passwd nagios Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

This must be the same nagios password of central


/usr/sbin/groupadd nagios /usr/sbin/usermod -a -G nagios nagios /usr/sbin/usermod -a -G nagios www-data

- 261 -

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-command-group=nagios --enablenanosleep --enable-event-broker make all make install make install-init make install-commandmode make install-config cd /usr/local/nagios/var/ mkdir spool cd spool mkdir checkresults cd /usr/local/nagios/ chown nagios:nagios -R var chmod 777 -R var export PATH="$PATH:/usr/local/nagios/bin/"

7.25

Poller: Nagios Plugins setup

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagiosplugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --withopenssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios nagios nagios nagios nagios nagios nagios ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: ALL=NOPASSWD: /etc/init.d/nagios restart /etc/init.d/nagios stop /etc/init.d/nagios start /etc/init.d/nagios reload /usr/local/nagios/bin/nagiostats /usr/local/nagios/bin/nagios * /usr/local/nagios/bin/ndo2db *

- 262 -

nagios

ALL=NOPASSWD: /usr/local/nagios/bin/ndomod.o *

User_Alias CENTREON=www-data,nagios Defaults:CENTREON !requiretty # Nagios Restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios* restart CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/nagios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # CentStorage Restart CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart # CentStorage stop CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop # CentStorage start CENTREON ALL = NOPASSWD: /etc/init.d/centstorage start ## END: CENTREON SUDO

7.26

Poller: Ndoutils setup

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz tar -xzf 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

configuration and installation


./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=nagios make

manual installation : After creating the binaries and libraries they have to be copied
cd /usr/local/src/ndoutils-1.4b9/src cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cd /usr/local/src/ndoutils-1.4b9/config cp ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

- 263 -

7.27

Poller: Centreon-Broker setup

Remember to allow remote connection in mysql server; and allow centreon user of mysql from any hosts!!!

TODO : faire un joli graphique avec les infos ci-dessous


Nagios via Central-module (TCP-IPv4) ==127.0.0.1:5668==> Central-Broker (TCP-IPv4)

Central-Broker (TCP-IPv4) ==> Central-Broker (Broker SQL) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfdata) ==127.0.0.1:3306==> MySQL base Centstorage

Central-Broker (TCP-IPv4) ==> Central-Broker (RRD) ==127.0.0.1:5669==> Central-RRD (TCP-IPv4)

Central-RRD (TCP-IPv4) ==> Central-RRD (RRD File Generator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker Pour la partie Compilation merci de se rfrer au lien ci-dessous.

http://forge.centreon.com/projects/centreon-broker/wiki/Build http://forge.centreon.com/projects/centreon-broker/wiki/Install

Building Centreon Broker

Overview
To build Centreon Broker, you will need the following external dependencies :

a C++ compilation environment. CMake, a cross-platform build system. the Qt framework with QtCore, QtSql and QtXml modules. RRDTool development files (for the RRD module).

And you need to get Centreon Broker sources (see in the "Checkout Centreon Broker" section). Centreon Broker is compatible only with Unix-like platforms (Linux, FreeBSD, Solaris, ...).

Dependencies
In binary form
Some OS provides binary versions of some dependencies required by Centreon Broker. To install them, use the standard package installation tool of your plateform (apt on Debian and Ubuntu, yum on Fedora, CentOS, RedHat) and install the following packages: Warning: Check the package version of CMake (>= 2.8) and Qt (>= 4.5) before installation. - 264 -

OS Version Package Name Debian build-essential C++ compilation environment Ubuntu Red Hat gcc-c++, make Debian CMake (>= 2.8) cmake Ubuntu Red Hat Debian libqt4-dev Qt (>= 4.5) Ubuntu Red Hat qt4-devel Debian librrd-dev RRDTool development files Ubuntu Red Hat rrdtool-devel

Software

With Debian or Ubuntu


You need to run:
apt-get install build-essential cmake libqt4-dev librrd-dev cd etc mkdir centreon chmod 777 R centreon

Compilation configuration
At the root of the project directory you'll find a build directory which holds build scripts. Generate the Makefile by running the following command: tar xzf centreon-broker-2.0.1.tar.gz cd centreon-broker-2.0.1 cd build
cmake .

CMake will check for all necessary dependencies and indicates if they could not be found.

Variables
Your Centreon Broker can be tweaked to your particular needs using CMake's variable system. Variables can be set like this:
$> cmake -D<variable1>=<value1> [-D<variable2>=<value2>] .

Here's the list of variables available and their description: Variable WITH_PREFIX Description Base directory for Centreon Broker installation. If other prefixes are - 265 -

expressed as relative paths, they are relative to this path. WITH_PREFIX_ARCHIVE Path in which development libraries (static libraries) will be installed. WITH_PREFIX_BINARY Path in which binaries will be installed. WITH_PREFIX_LIBRARY Where shared objects (like @em cbmod.so) will be installed. WITH_PREFIX_MODULES Where Centreon Broker modules will be installed.

Example
$> cmake -DWITH_PREFIX=/usr/local/centreon-broker DWITH_PREFIX_LIBRARY=/usr/lib/nagios .

Compilation
Once properly configured, the compilation process is really simple. Just run:
$> make

And wait until compilation completes.

Installation
See the broker installation page.

Installing Centreon Broker


Installation Process
Centreon Broker has multiple components which can be splitted in 5 groups :

binaries Centreon Engine / Nagios modules Centreon Broker modules development headers development libraries

Each of these groups can have a separate installation directory which are configurable as specified in the "Building Centreon Broker" section. Once Centreon Broker has been successfully built, the install process is very simple. Just run the following command as a priviledged user:
$> make install

Packages
Centreon Broker can be packaged directly as a RPM or a DEB package using CPack (part of the CMake software suite). To generate the appropriate package, refer to the @ref build "Building Centreon Broker" section and set the following variables to enable package creation:

CPACK_BINARY_DEB for Debian package generation CPACK_BINARY_RPM for RPM package generation

- 266 -

Also note that Merethis provides RPM packages of Centreon Broker using its Centreon Enterprise Server (CES) product.

Pour les installations sur Debian, il faut ajouter la librairie librrd-dev en plus. Bien noter le rsultat du make install pour avoir les chemins qui seront utile par la suite.

cd /usr/local/src/centreon-broker-2.0.1/script cp redhat-init.d-broker.sh /etc/init.d/central-broker cp redhat-init.d-rrd.sh /etc/init.d/central-rrd

modify the /etc/init.d/central-broker and the /etc/init.d/central-rrd as follow: from RunDir=/var/run/centreon to RunDir=/var/run cd /etc/init.d chmod 777 central-broker

- 267 -

chmod 777 central-rrd

update-rc.d central-broker defaults update-rc.d central-rrd defaults

cd /etc/ mkdir centreon chmod 777 R centreon cd /usr/local mkdir centreon cd centreon mkdir log cd /usr/local chmod 777 R centreon cd /var/lib/centreon mkdir metrics mkdir status cd /var/lib/ chmod 777 R centreon

cd /usr/local/centreon/log mkdir centreon-broker chmod 777 R centreon-broker

7.28

Poller: Enable snmp

vi /etc/default/snmpd

and change these sections:


#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.77.3.121'

Where 10.77.3.121 is the host / network allowed to ask for snmp entries.
#TRAPDRUN=no TRAPDRUN=yes

Edit snmpd configuration file:


vi /etc/snmp/snmpd.conf

and change this section:


# sec.name source default default 127.0.0.1 community public public public

#com2sec paranoid com2sec readonly com2sec readonly

- 268 -

com2sec readonly

192.168.0.0/24

public private

#com2sec readwrite default

Or more simply :
vi /etc/snmp/snmpd.conf

delete all the content of this file and type:


rocommunity public service snmpd restart

7.29

Poller: Check services

sysv-rc-conf

- 269 -

Check Nagios and snmpd to startup at 2,3,4 and 5 runlevel and reboot

- 270 -

7.30

Central1: Add Poller to Central

Setting up key authentication using SSH On the central server generate a key pair using ssh-keygen. Accept all defaults (LEAVE BLANK PASSWORD).
root@central:/# cd /usr/local/nagios/libexec root@central:/usr/local/nagios/libexec# su nagios
$ ssh-keygen

Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: c3:27:df:68:67:ba:8a:60:1e:47:a1:8d:ad:ac:db:dc nagios@central The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | = o | | o + S . | | . o = o | | * . + + | | * = . . + | | o.+ E ..o. | +-----------------+

Transfer the public key to the satellite monitor for the Nagios daemon owner. (Replace {IP_ADDRESS} with the IP address of the satellite monitor.)
$ ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@poller000.localdomain.com The authenticity of host '10.77.0.49 (10.77.0.49)' can't be established. RSA key fingerprint is 5f:43:48:83:d0:42:eb:ab:42:08:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.77.0.49' (RSA) to the list of known hosts. nagios@10.77.0.49's password: Now try logging into the machine, with "ssh 'nagios@10.77.0.49'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.

The last command will ask for the password of nagios on the satellite monitor. If these steps are succesfully completed, you should be able to log on to the satellite monitor via SSH without entering a password. Verify that you could access to the satellite without password prompt:
ssh nagios@poller000.localdomain.com

From central centreon Synchronize commands with the satellite (only if you are using the same architecture on both side 32bits or 64bits):
scp /usr/local/nagios/libexec/* nagios@poller000.localdomain.com:/usr/local/nagios/libexec

- 271 -

scp /usr/local/nagios/bin/ndomod.o nagios@poller000.localdomain.com:/usr/local/nagios/bin

if you encounter access denied errors like:


scp: /usr/local/nagios/libexec/check_dhcp: Permission denied

Delete files from satellite and resync again with scp.

7.31

Central1: Add Poller to Centreon configuration

On the poller:
cd /usr/local/nagios/etc rm *

Duplicate Poller cfg:

Duplicate nagios.cfg:

- 272 -

7.32

Central1: Configuring Centreon to let the Poller use Centreon-Broker

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg Administration -> Options -> Monitoring : s Monitoring database layer change to Centreon Broker - 273 -

Disable / remove ndo2db service

Activation de Centreon-Broker
Pour ajouter des broker dans centreon, aller dans Configuration -> Centreon -> Centreon-Broker : Configuration

Central-Broker

Complter longlet "General"

Name : Central-broker Config file name : central-broker.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

- 274 -

Name : Central Master Connection port : 5668

Complter longlet "Logger" avec lajout dun "Core File" (il faut que larborescence existe sinon cbd se plantera)

Name of the logger : /usr/local/centreon/log/centreon-broker/central-broker.log

Complter longlet "Output" avec lajout (dans l'ordre) dun "SQL Broker SQL Database", un "Storage Perfdata Generator (Centreon Storage)" et dun "TCP - Ipv4"

- 275 -

Name : Broker SQL DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : Perfdata Master Interval Length : 60 RRD Length : 155552000 DB Type : MySQL DB host : 10.77.3.122 DB Port : 3306 DB user : centreon DB password : password DB name : centstorage Name : RRD Master Connection port : 5669 Host to connect to : 127.0.0.1

- 276 -

Central-RRD

Complter longlet "General"

- 277 -

Name : Central-RRD Config file name : central-RRD.xml

Complter longlet "Input" avec lajout dun "TCP -IPv4"

Name : RRD-Master Connection port : 5669

Complter longlet "Logger" avec lajout dun "Core File"

- 278 -

Name of the logger : /usr/local/centreon/log/centreon-broker/central-rrd.log

Complter longlet "Output" avec lajout dun "RRD RRD File Generator"

Name : RRD-File Metrics RRD Directory : /var/lib/centreon/metrics Status RRD Directory : /var/lib/centreon/status

Central-Module

Complter longlet "General"

Name : Central-module Config File Name : central-module.xml

- 279 -

Il n'y a pas d'input pour le module Complter longlet "Logger" avec lajout dun "Core File"

Name of the logger : /usr/local/centreon/log/centreon-broker/central-module.log

Complter longlet "Output" avec lajout dun "TCP -IPv4"

Name : Central-Module-Output Connection port : 5668 Host to connect to : 127.0.0.1

- 280 -

Export des fichiers de config


Les fichiers de configuration du broker sont export en mme temps que la config de Nagios. Il faut donc faire :

Configuration -> Nagios : Gnrer et Dplacer

reboot

7.33

Central2: Simply clone Central1 to Central2

Clone the Central1 to Central2 and remember to use them just as Central server, not as Pollers.

- 281 -

8. Plugins and others... 8.0 Problems with plugins

Problem with plugin:

To run as root, you can use a tool like sudo. To set the setuid permissions, use the command: chmod u+s yourpluginfile check_icmp: Failed to obtain ICMP socket: Operation not permitted
chmod u+s check_centreon_ping chmod u+s check_icmp

Check mod for temporary file : /var/lib/centreon/centplugins/remote_storage_cache_10.77.3.121...

cd /var/lib mkdir centreon cd centreon mkdir centplugins cd /var/lib chmod 777 -R centreon

8.1

nagvis

Pr requis
Le paquet curl doit tre prsent sur le serveur debian
apt-get install curl install graphviz

Installation en ligne de commande


Vous devez rcuprer les binaires sur le site de la forge monitoring-fr Dcompressez l'archive.
cd /usr/local/src tar xzf centreon-nagvis-2.2b.tar.gz cd centreon-nagvis-2.2b

L'installation tlchargera automatiquement la dernire version de Nagvis si vous tes connect Internet avec le serveur. Malheureusement dans certaine entreprise, vous n'avez pas accs Internet - 282 -

pour les serveurs. Dans ce cas, copiez l'archive de Nagvis, pralablement tlcharge, dans le dossier /tmp

Configurez le fichier setup.conf


!/bin/bash TMP="/tmp" MODULE_NAME="nagvis" LOCALMACHINE="localhost" HTTPD_USER="www-data" HTTPD_GROUP="www-data" HTTPD_CONF="/etc/apache2/conf.d" HTTPD_INIT="/etc/init.d/apache2" CENTREON_WWW="/usr/local/centreon/www" CENTREON_ETC="/etc/centreon" NAGVIS_PATH="/usr/local/nagvis" CENTREONURI="http://localhost/centreon" CENTREONU="admin" CENTREONP="password" NAGVISBRANCH="1.5" NAGVISVER="${NAGVISBRANCH}.9" NAGVISDL="http://downloads.sourceforge.net/project/nagvis/NagVis%20$NAGVISBRANCH/nagvis$NAGVISVER.tar.gz" NAGVISPATH="/usr/local/nagvis" NAGVISURI="/nagvis" NAGVISBACKENDS="ndo2db" NAGVISNDO="/usr/local/nagios/bin/ndo2db" NAGVISLIVE="unix:/opt/monitor/var/rw/live" ENGINE="Nagios" ENGINEPATH="/usr/local/nagios" ENGINEBIN="/usr/local/nagios/bin/nagios" GRAPHVIZBIN="/usr/bin" MYSQLUSER="root" MYSQLPASSWD="password" MYSQLHOST="localhost" MYSQLPORT="3306" CENTREONDB="centreon" CENTREONUSER="centreon" CENTREONPASSWD="password" CENTSTATUSDB="centstatus" NAGVISDB="nagvis" NAGVISUSER="nagvis" NAGVISPASS="password" INSTANCE="Central"

# DO NOT MODIFY HERE ! sqlmoduleconf="USE $CENTREONDB; INSERT INTO options (\`key\`,\`value\`) INSERT INTO options (\`key\`,\`value\`) INSERT INTO options (\`key\`,\`value\`) INSERT INTO options (\`key\`,\`value\`) INSERT INTO options (\`key\`,\`value\`)

VALUES VALUES VALUES VALUES VALUES

('centreon-nagvis-db-password','$NAGVISPASS'); ('centreon-nagvis-db-user','$NAGVISUSER'); ('centreon-nagvis-db-name','$NAGVISDB'); ('centreon-nagvis-db-port','$MYSQLPORT'); ('centreon-nagvis-db-host','$MYSQLHOST');"

sqlclean="DROP TABLE IF EXISTS $CENTREONDB.centreonnagvis; DROP DATABASE IF EXISTS $NAGVISDB;" sqlcentreon="use $CENTREONDB; CREATE TABLE centreonnagvis int(10) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;" ( acl_group_id int(10) NOT NULL, roleId

sqlacl="GRANT ALL PRIVILEGES ON $NAGVISDB.* to '$NAGVISUSER'@'$LOCALMACHINE' identified by '$NAGVISPASS'; GRANT SELECT on $CENTREONDB.centreonnagvis to '$NAGVISUSER'@'$LOCALMACHINE'; GRANT SELECT on $CENTREONDB.acl_groups to '$NAGVISUSER'@'$LOCALMACHINE'; GRANT SELECT on $CENTREONDB.session to '$NAGVISUSER'@'$LOCALMACHINE';

- 283 -

GRANT GRANT GRANT FLUSH

SELECT on $CENTREONDB.acl_group_contacts_relations to '$NAGVISUSER'@'$LOCALMACHINE'; SELECT on $CENTREONDB.contact to '$NAGVISUSER'@'$LOCALMACHINE'; SELECT on $NAGVISDB.roles to '$CENTREONUSER'@'$LOCALMACHINE'; PRIVILEGES;"

sqlnagvisdb="CREATE DATABASE IF NOT EXISTS $NAGVISDB DEFAULT CHARACTER SET latin1 ; USE $NAGVISDB ; DROP TABLE IF EXISTS perms ; CREATE TABLE perms ( permId int(10) NOT NULL AUTO_INCREMENT, \`mod\` varchar(100) DEFAULT NULL, \`act\` varchar(100) DEFAULT NULL, \`obj\` varchar(100) DEFAULT NULL, PRIMARY KEY ( permId ), UNIQUE KEY permId ( \`mod\` , \`act\` , \`obj\` ) ) ENGINE=MyISAM AUTO_INCREMENT=150 DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS roles ; CREATE TABLE roles ( roleId int(10) NOT NULL AUTO_INCREMENT, name varchar(100) DEFAULT NULL, PRIMARY KEY ( roleId ), UNIQUE KEY roleId ( name ) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS roles2perms ; CREATE TABLE roles2perms ( roleId int(10) DEFAULT NULL, permId int(10) DEFAULT NULL, UNIQUE KEY roleId ( roleId , permId ) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS users ; CREATE TABLE users ( userId int(10) NOT NULL AUTO_INCREMENT, name varchar(100) DEFAULT NULL, password varchar(40) DEFAULT NULL, PRIMARY KEY ( userId ), UNIQUE KEY userId ( name ) ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS users2roles ; CREATE TABLE users2roles ( userId int(10) DEFAULT NULL, roleId int(10) DEFAULT NULL, UNIQUE KEY userId ( userId , roleId ) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS version ; CREATE TABLE version ( version varchar(100) NOT NULL DEFAULT '', PRIMARY KEY ( version ) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"

LOCALMACHINE correspond au nom du serveur pour la connexion MySql. Dans notre cas les connexions MySql pour Centreon se font avec centreon@localhost, car notre serveur comprend la base MySql. Dans le cas d'une base externe, il faudra mettre le nom du serveur.
#!/bin/bash TMP="/tmp" MODULE_NAME="nagvis" LOCALMACHINE="localhost"

Ces lignes correspondent aux paramtres Apache


HTTPD_USER="www-data" HTTPD_GROUP="www-data" HTTPD_CONF="/etc/apache2/conf.d" HTTPD_INIT="/etc/init.d/apache2"

- 284 -

Ces lignes correspondent aux paramtrages de Centreon.


CENTREON_WWW="/usr/local/centreon/www" CENTREON_ETC="/etc/centreon" NAGVIS_PATH="/usr/local/nagvis" CENTREONURI="http://localhost/centreon" CENTREONU="admin" CENTREONP="passwd admin centreon"

Ces lignes correspondent aux paramtrages de Nagvis, normalement il faut laisser par dfaut.
NAGVISBRANCH="1.5" NAGVISVER="${NAGVISBRANCH}.9" NAGVISDL="http://downloads.sourceforge.net/project/nagvis/NagVis%20$NAGVISBRANCH /nagvis-$NAGVISVER.tar.gz" NAGVISPATH="/usr/local/nagvis" NAGVISURI="/nagvis"

Pour utiliser la version 1.5.10 modifier la ligne suivante


NAGVISVER="${NAGVISBRANCH}.10"

Paramtre du broker ndoutils, le paramtre NAGVISLIVE ne sera pas utilis


NAGVISBACKENDS="ndo2db" NAGVISNDO="/usr/local/nagios/bin/ndo2db-3x" NAGVISLIVE="unix:/opt/monitor/var/rw/live"

Paramtres pour Nagios, normalement par dfaut


ENGINE="Nagios" ENGINEPATH="/usr/local/nagios" ENGINEBIN="/usr/local/nagios/bin/nagios" GRAPHVIZBIN="/usr/bin"

Il reste saisir les paramtres pour Mysql, et la cration du user nagvis pour la base Mysql.
MYSQLUSER="root" MYSQLPASSWD="passwd mysql" MYSQLHOST="localhost" MYSQLPORT="3306" CENTREONDB="centreon" CENTREONUSER="centreon" CENTREONPASSWD="passwd centreon" CENTSTATUSDB="centstatus" NAGVISDB="nagvis" NAGVISUSER="nagvis" NAGVISPASS="passwd nagvis" INSTANCE="Central"

Lancez l'installation
./setup.sh -i Parsing arguments Checking existing installation Checking database centreon for centreonnagvis table Checking database nagvis Checking centreon module /usr/local/centreon/www/modules/nagvis folder Deploy module Deploying databases modifications > creating table centreon nagvis in centreon > creating database nagvis > populating nagvis database Install module Getting nagvis --2011-07-24 19:47:04--

- 285 -

http://downloads.sourceforge.net/project/nagvis/NagVis%201.5/nagvis-1.5.9.tar.gz Rsolution de downloads.sourceforge.net... 216.34.181.59, 216.34.181.59 Connexion vers downloads.sourceforge.net|216.34.181.59|:80...connect. requte HTTP transmise, en attente de la rponse...302 Found Emplacement: http://freefr.dl.sourceforge.net/project/nagvis/NagVis%201.5/nagvis-1.5.9.tar.gz [suivant] --2011-07-24 19:47:04-http://freefr.dl.sourceforge.net/project/nagvis/NagVis%201.5/nagvis-1.5.9.tar.gz Rsolution de freefr.dl.sourceforge.net... 88.191.250.132 Connexion vers freefr.dl.sourceforge.net|88.191.250.132|:80...connect. requte HTTP transmise, en attente de la rponse...200 OK Longueur: 3298253 (3,1M) [application/x-gzip] Sauvegarde en : nagvis-1.5.9.tar.gz 100%[===============================================>] 3 298 253 9,3s 2011-07-24 19:47:14 (347 KB/s) - nagvis-1.5.9.tar.gz sauvegard [3298253/3298253] installing nagvis 315K/s ds

Configuration du module Centreon-Nagvis


Tout d'abord, une chose importante : un compte administrateur de Centreon ne peut pas visualiser la vue Nagvis. Si vous avez une installation flambante neuve, il vous faudra crer un utilisateur standard dans Centreon.

Cration des utilisateurs


Nous allons crer un utilisateur supervision qui fera partie du groupe de contact niveau1. Celui-ci recevra les autorisations pour la vue Nagvis et l'accs aux ressources. Ce groupe sera limit la vue dans Nagvis en lecture seule. Un groupe d'accs nagvisRO sera initialis pour correspondre au groupe Read-Only de Nagvis. Il faudra crer un utilisateur exploitant qui fera partie du groupe de contact niveau2. Ce groupe recevra des autorisations plus importantes telles que les actions d'acquittements des alarmes. En outre, ce groupe aura le droit de modifier la cartographie de Nagvis. Un groupe d'accs nagvisRW sera initialis pour correspondre au groupe Administrators de Nagvis.

Cration du groupe de contact niveau1. - 286 -

Liste des groupes de contacts

Cration de l'utilisateur supervision associ au groupe niveau1

Celui-ci n'est pas administrateur. Faire de mme pour l'utilisateur exploitant et son groupe de contact associ niveau2

Liste des utilisateurs

- 287 -

Configuration des ACL de Centreon


Maintenant, crez deux groupes d'accs nagvisRW et nagvisRO.

supervision et niveau1 devront tre slectionns pour le groupe d'accs nagvisRO

exploitant et niveau2 devront tre slectionns pour le groupe d'accs nagvisRW Nous donnerons accs aux menus de Centreon avec les groupes d'accs aux Menus MNUniveau1 et MNUniveau2.

- 288 -

Le niveau 1 aura une vue limite au monitoring en temps rel de la supervision. Ne pas oublier d'associer le groupe d'accs nagvisRO.

- 289 -

Le niveau 2 aura une vue plus tendue. Ne pas oublier d'associer le groupe d'accs nagvisRW.

Ensuite nous utiliserons un groupe d'accs aux ressources nomm All Ressources (celui cr par dfaut lors de l'installation de Centreon) et nous ajouterons les deux groupes d'accs nagvisRW et nagvisRO.

- 290 -

Pour information, nous crerons le groupe d'accs aux actions pour le niveau2 et nous ajouterons le groupe d'accs nagvisRW. Les actions permises par ce groupe seront coches dans la liste propose.

Configuration du mappage Nagvis-Centreon


Nos ACL tant crs, nous devons associer chaque groupe d'accs un groupe de Nagvis. Slectionnez Configuration -> Nagvis -> ACL

Dans notre exemple le groupe nagvisRO (nagios en lecture seule) sera associ au groupe Users (read-only) et le groupe nagvisRW (admin nagvis) sera associ au groupe Administrators. N'oubliez pas de sauvegarder.

Vrification
Et voila, votre module est fonctionnel. Vous pouvez le tester en vous connectant en exploitant. La vue Nagvis est parfaitement intgre dans l'interface Centreon.

- 291 -

Un conseil, n'oublier pas de changer le mot de passe par dfaut de l'administrateur nagiosadmin propos par Nagvis.

Utilisation des utilisateurs en lecture seule


Dernire chose paramtrer, un utilisateur Nagvis en lecture seule. Si vous vous connectez en supervision sans ce dernier paramtrage vous aurez cette vue ci-dessous.

Cette situation est tout fait normale, car il n'y a pas de relation entre les utilisateurs Centreon et un utilisateur Nagvis en lecture seule (Il n'existe pas en fait). Pour remdier, se connecter en administrateur (par exemple en exploitant). Slectionnez le menu User Menu / Manage Users

- 292 -

Crer l'utilisateur supervision ou tout autre nom.

Lui affecter le rle Users (read-only). N'oubliez pas de sauvegarder et quitter l'interface. Vous pouvez utiliser sans problme le compte supervision.

8.2

syslog

Installation du module Centreon Syslog Frontend


Nous allons aborder l'installation du module Centreon Syslog Frontend, celui permet de visualiser les logs du serveur Syslog dans l'interface Centreon. Ce module permet d'effectuer des recherches et/ou des tris selon certains paramtres (date, niveau d'alerte, etc)

Pr requis
Il nous faut installer la librairie libssh2 pour la connexion ssh entre le serveur de supervision et syslog, les outils de dveloppement php5.
apt-get install libssh2-1-dev php5-dev apt-get install libssh2-php apache2ctl -k graceful pecl install -f ssh2-beta

On rcupre la librairie PECL


cd /usr/local/src/ wget http://pecl.php.net/get/ssh2-0.11.0.tgz tar xzf ssh2-0.11.0.tgz cd ssh2-0.11.0

- 293 -

Il faut compiler le module ssh pour php


phpize && ./configure --with-ssh2 && make

Copier le module dans php5


cp modules/ssh2.so /usr/lib/php5/20060613+lfs

On doit faire prendre en compte cette librairie par le serveur apache


echo "extension=ssh2.so" > /etc/php5/cli/conf.d/ssh2.ini echo "extension=ssh2.so" > /etc/php5/apache2/conf.d/ssh2.ini

Redmarrer le serveur apache


/etc/init.d/apache2 restart

Vrifions l'activation de ssh2


php -i |grep ssh Registered PHP Streams => zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp ssh2 libssh2 version => 0.18 banner => SSH-2.0-libssh2_0.18

Installation en mode ligne de commande sur le serveur de supervision


Vous devez rcuprer les binaires sur le site de Centreon.(authentification obligatoire)
cd /usr/local/src tar xzf centreon-syslog-frontend-1.3.3.tar.gz cd centreon-syslog-frontend-1.3.3 ./install -i

Dcompresser l'archive dans /usr/local/src et lancer l'installation


############################################################################### # # # http://forge.centreon.com/projects/show/centreon-syslog # # Thanks for using Centreon # # # # v1.3.3 # # # ############################################################################### -----------------------------------------------------------------------Checking all needed binaries -----------------------------------------------------------------------rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK

- 294 -

You will now read Centreon Syslog module Licence. Press enter to continue.

Vrification des pr requis, appuyer sur Entre


This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Do you accept GPL license ? [y/n], default to [n]: > y

Accepter la licence
-----------------------------------------------------------------------Load parameters -----------------------------------------------------------------------Please specify the directory with contain "instCentWeb.conf" > /etc/centreon

Saisir le chemin du dossier de configuration de Centreon


-----------------------------------------------------------------------Checking php extension -----------------------------------------------------------------------SSH2 extension for PHP: OK XML-Writer extension for PHP: OK -----------------------------------------------------------------------Install Syslog Module -----------------------------------------------------------------------Setting right OK Setting owner/group OK Changing macro OK Create a directory to backup old files OK Backup old installation OK Copying module OK Delete temp install directory OK Setting owner/group on Nagios plugin OK Install Nagios plugin OK Delete temp install directory OK The Centreon Module Syslog.1.3.3 installation is finished OK See README and the log file for more details. ############################################################################### # # # Go to the URL : http://your-server/centreon/ # # to finish the setup # # # # Report bugs at # # http://forge.centreon.com/projects/centreon-syslog/issues/new # # # ###############################################################################

L'installation en ligne de commande est termine

Installation du module dans Centreon


Il faut se connecter l'interface Web de centreon - 295 -

Slectionnez Administration / Modules. Cliquez sur l'icne droite pour installer le module.

Cliquez sur le bouton Install Modules

L'installation s'est bien passe, cliquer sur le bouton back.

- 296 -

L'installation du module est termine, vous pouvez accder sa configuration.

Une nouvelle vue Syslog a t cr dans la section Monitoring, mais celle-ci n'est pas encore fonctionnelle. Il faut configurer l'authentification ssh entre le serveur de supervision et le serveur syslog.

Configuration du module
Avant de raliser la configuration du module, affectez un mot de passe l'utilisateur syslog sur le serveur Syslog.
root@syslog:~# passwd syslog Entrez le nouveau mot de passe UNIX : syslog2011 Retapez le nouveau mot de passe UNIX : syslog2011 passwd : le mot de passe a t mis jour avec succs

Slectionnez Administration / Modules.

- 297 -

Cliquez sur Configuration

Cliquez sur Modify pour modifier la configuration

- 298 -

Onglet Database : Saisir l'adresse IP du serveur Syslog, le nom de la base Syslog et le mot de passe syslogadmin

Onglet SSH : Saisir l'adresse IP du serveur Syslog, le mot de passe de l'utilisateur syslog

Onglet Configuration : Saisir le chemin du fichier de configuration de syslog sur le serveur Syslog. Sauvegarder la configuration en cliquant sur le bouton Save.

Il faut exporter le fichier de configuration vers le serveur Syslog. Cliquer sur le bouton Export Configuration

- 299 -

Le fichier a bien t envoy. Attention, il y a un problme de configuration dans la connexion Mysql que je n'arrive pas expliquer actuellement. Remettre l'adresse ip du serveur Syslog dans l'onglet Database.

Sauvegarder la configuration sans l'exporter. Retour la vue Monitoring, il n'y a toujours pas de donnes affiches ! En fait le serveur Mysql de Syslog n'accepte pas les connexions externes. Il faut donc modifier le fichier de configuration my.cnf du serveur Syslog.
bind-address = 172.16.209.132

Modifier le paramtre bind-address et relancer le serveur Mysql


/etc/init.d/mysql restart

- 300 -

Cliquez sur Monitoring / Syslog. Vous avez vos messages syslog.

Cliquez sur Search, vous avez un message d'erreur. C'est un fonctionnement normal. La table des logs de la journe actuelle n'est pas encore prsente. Il faudra attendre 23 h 59 pour que le script /usr/bin/syslog/tableLogRotate.php s'excute. Il y a possiblit de forcer son excution en se connectant sur le serveur Syslog.
root@syslog:/usr/bin/syslog# php tableLogRotate.php BEGIN TABLES LOGS ROTATION AT 2011-05-06 15:53:10 DROP TABLE all_logs RENAME TABLE logs TO logs20110507 CREATE TABLE logs CREATE MERGE TABLE all_logs

- 301 -

END OF TABLES LOGS ROTATION AT 2011-05-06 15:53:10 BEGIN TABLES CACHE ROTATION AT 2011-05-06 15:53:10 DROP TABLE all_cache RENAME TABLE cache TO cache20110507 CREATE MERGE TABLE all_cache END OF TABLES CACHE ROTATION AT 2011-05-06 15:53:10

La table est cre, vous pouvez retourner sur Centreon et visualiser les logs.

Vous avez la possibilit de filtrer sur une priode de date et d'exporter au format csv ou open office.

Mise en place de la coloration syntaxique des vnements


Pour bnficier de la coloration des vnements en fonction de leur criticit, nous devons modifier le fichier de configuration de Rsyslog. Cette modification permettra d'afficher au format texte, les champs Facility et Severity. Editez le fichier /etc/rsyslog.conf et modifiez l'avant dernire ligne comme ci-dessous.
$template sysMysql,"INSERT INTO logs (host,facility, priority,level,tag,datetime,program,msg) VALUES ('%HOSTNAME%','%syslogfacility-text%','%syslogprioritytext%','%syslogseverity%', '%syslogtag%', '%timereported:::date-mysql%','%programname%', '%msg%')", SQL

Nous rajoutons le suffixe -text aux champs syslogfacility et syslogpriority. N'oubliez pas de relancer le serveur syslog.
/etc/init.d/rsyslog restart

- 302 -

Les champs se remplissent aussitt avec du texte, le champ Severity change de couleur en fonction de la criticit de l'vnement comme ci-dessous.

L'installation de notre Syslog est termine. Pour effectuer une ventuelle mise jour du module, visiter cette page. Il restera complter l'installation du module de langue franais. Nous allons, maintenant, aborder la centralisation des vnements windows par l'intermdiaire de Centreon E2S.

8.3

geolocation

- 303 -

Вам также может понравиться