centre on

303
- 1 - 02.03.2012 Cristian Colombini

Upload: nguyen-chung

Post on 30-Dec-2015

130 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Centre On

- 1 -

02.03.2012 Cristian Colombini

Page 2: Centre On

- 2 -

1. Setup of a Central server with engine: Nagios, Broker: ndo2d, database: local MySql 1.1 Central: Ubuntu server setup 1.2 Central: First login 1.3 Central: Necessary components 1.4 Central: Nagios setup 1.5 Central: Nagios Plugins setup 1.6 Central: Ndoutils setup 1.7 Central: Enable snmp 1.8 Central: Check services 1.9 Central: Install Centreon 1.10 Central: Finishing setup of Centreon 1.11 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 Central: Ubuntu server setup 2.2 Central: First login 2.3 Central: Necessary components 2.4 Central: Nagios setup 2.5 Central: Nagios Plugins setup 2.6 Central: Ndoutils setup 2.7 Central: Enable snmp 2.8 Central: Check services 2.9 Central: Install Centreon 2.10 Central: Finishing setup of Centreon 2.11 Central: Configuring webinterface 2.12 Poller: Ubuntu server setup 2.13 Poller: First login 2.14 Poller: Necessary components 2.15 Poller: Nagios setup 2.16 Poller: Nagios Plugins setup 2.17 Poller: Ndoutils setup 2.18 Poller: Enable snmp 2.19 Poller: Check services 2.20 Central: Add Poller to Central 2.21 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 MySql: Ubuntu server setup 3.2 MySql: First login 3.3 MySql: Necessary components 3.4 MySql: Enable snmp 3.5 MySql: Check services 3.6 MySql: Configure root user of mysql from any hosts 3.7 Central: Ubuntu server setup 3.8 Central: First login 3.9 Central: Necessary components

Page 3: Centre On

- 3 -

3.10 Central: Nagios setup 3.11 Central: Nagios Plugins setup 3.12 Central: Ndoutils setup 3.13 Central: Enable snmp 3.14 Central: Check services 3.15 Central: Install Centreon 3.16 Central: Finishing setup of Centreon 3.17 MySql: Configure centreon user of mysql from any hosts 3.18 MySql: Reset admin password 3.19 Central: Configuring webinterface 3.20 Poller: Ubuntu server setup 3.21 Poller: First login 3.22 Poller: Necessary components 3.23 Poller: Nagios setup 3.24 Poller: Nagios Plugins setup 3.25 Poller: Ndoutils setup 3.26 Poller: Enable snmp 3.27 Poller: Check services 3.28 Central: Add Poller to Central 3.29 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 Central: Ubuntu server setup 5.2 Central: First login 5.3 Central: Necessary components 5.4 Central: Nagios setup 5.5 Central: Nagios Plugins setup 5.6 Central: Ndoutils setup 5.7 Central: Centreon-Broker setup 5.8 Central: Enable snmp 5.9 Central: Check services 5.10 Central: Install Centreon 5.11 Central: Finishing setup of Centreon 5.12 Central: Configuring Centreon to use Centreon-Broker 5.13 Poller: Ubuntu server setup 5.14 Poller: First login 5.15 Poller: Necessary components 5.16 Poller: Nagios setup 5.17 Poller: Nagios Plugins setup 5.18 Poller: Ndoutils setup 5.19 Poller: Centreon-Broker setup 5.20 Poller: Enable snmp 5.21 Poller: Check services

Page 4: Centre On

- 4 -

5.22 Central: Add Poller to Central 5.23 Central: Add Poller to Centreon configuration 5.24 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 MySql: Ubuntu server setup 6.2 MySql: First login 6.3 MySql: Necessary components 6.4 MySql: Enable snmp 6.5 MySql: Check services 6.6 MySql: Configure root user of mysql from any hosts 6.7 Central: Ubuntu server setup 6.8 Central: First login 6.9 Central: Necessary components 6.10 Central: Nagios setup 6.11 Central: Nagios Plugins setup 6.12 Central: Ndoutils setup 6.13 Central: Centreon-Broker setup 6.14 Central: Enable snmp 6.15 Central: Check services 6.16 Central: Install Centreon 6.17 Central: Finishing setup of Centreon 6.18 MySql: Configure centreon user of mysql from any hosts 6.19 MySql: Reset admin password 6.20 Central: Configuring Centreon to use Centreon-Broker 6.21 Poller: Ubuntu server setup 6.22 Poller: First login 6.23 Poller: Necessary components 6.24 Poller: Nagios setup 6.25 Poller: Nagios Plugins setup 6.26 Poller: Ndoutils setup 6.27 Poller: Centreon-Broker setup 6.28 Poller: Enable snmp 6.29 Poller: Check services 6.30 Central: Add Poller to Central 6.31 Central: Add Poller to Centreon configuration 6.32 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 MySql: Ubuntu server setup 7.2 MySql: First login 7.3 MySql: Necessary components 7.4 MySql: Enable snmp 7.5 MySql: Check services 7.6 MySql: Configure root user of mysql from any hosts 7.7 Central1: Ubuntu server setup

Page 5: Centre On

- 5 -

7.8 Central1: First login 7.9 Central1: Necessary components 7.10 Central1: Nagios setup 7.11 Central1: Nagios Plugins setup 7.12 Central1: Ndoutils setup 7.13 Central1: Centreon-Broker setup 7.14 Central1: Enable snmp 7.15 Central1: Check services 7.16 Central1: Install Centreon 7.17 Central1: Finishing setup of Centreon 7.18 MySql: Configure centreon user of mysql from any hosts 7.19 MySql: Reset admin password 7.20 Central1: Configuring Centreon to use Centreon-Broker 7.21 Poller: Ubuntu server setup 7.22 Poller: First login 7.23 Poller: Necessary components 7.24 Poller: Nagios setup 7.25 Poller: Nagios Plugins setup 7.26 Poller: Ndoutils setup 7.27 Poller: Centreon-Broker setup 7.28 Poller: Enable snmp 7.29 Poller: Check services 7.30 Central1: Add Poller to Central 7.31 Central1: Add Poller to Centreon configuration 7.32 Central1: Configuring Centreon to let the Poller use Centreon-Broker 7.33 Central2: Simply clone Central1 to Central2 8. Plugins and others... 8.0 Problems with plugins 8.1 nagvis 8.2 syslog 8.3 geolocation

Page 6: Centre On

- 6 -

Page 7: Centre On

- 7 -

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).

Page 8: Centre On

- 8 -

Page 9: Centre On

- 9 -

1.2 Central: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 central.localdomain.com centr al 10.77.3.120 central.localdomain.com centr al 10.77.3.121 poller000.localdomain.com pol ler000

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

Page 10: Centre On

- 10 -

Restart network services cd /etc/init.d ./networking restart

1.3 Central: Necessary components System update Once it’s 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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5 aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v sysv-rc-conf dnsutils -y

1.4 Central: Nagios setup

Page 11: Centre On

- 11 -

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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz

Page 12: Centre On

- 12 -

cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios -group=nagios --with-openssl=/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/n doutils1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:

Page 13: Centre On

- 13 -

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 community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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 st artup at 2,3,4 and 5 runlevel And reboot

Page 14: Centre On

- 14 -

1.9 Central: Install Centreon

Page 15: Centre On

- 15 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y

Page 16: Centre On

- 16 -

--------------------------------------------------- --------------------- Start CentWeb Installation --------------------------------------------------- --------------------- Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory

Page 17: Centre On

- 17 -

default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc OK Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK

Page 18: Centre On

- 18 -

Change macros for dashboardBuilder.pl OK Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- ---------------------

Page 19: Centre On

- 19 -

Create /usr/local/centreon/www/install/install.conf .php OK 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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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]

Page 20: Centre On

- 20 -

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

Page 21: Centre On

- 21 -

Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ################################################### ############################ # # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start

1.10 Central: Finishing setup of Centreon Connect via browser to http://yourcentral-ip/centreon

Page 22: Centre On

- 22 -

Page 23: Centre On

- 23 -

1.11 Central: Configuring webinterface

broker_module=

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

Page 24: Centre On

- 24 -

Correct the errors:

Page 25: Centre On

- 25 -

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

Page 26: Centre On

- 26 -

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).

Page 27: Centre On

- 27 -

Page 28: Centre On

- 28 -

2.2 Central: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 central.localdomain.com centr al 10.77.3.120 central.localdomain.com centr al 10.77.3.121 poller000.localdomain.com pol ler000

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

Page 29: Centre On

- 29 -

Restart network services cd /etc/init.d ./networking restart

2.3 Central: Necessary components System update Once it’s 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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5 aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v sysv-rc-conf dnsutils -y

2.4 Central: Nagios setup

Page 30: Centre On

- 30 -

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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-1.4.15.tar.gz tar -xzf nagios-plugins-1.4.15.tar.gz

Page 31: Centre On

- 31 -

cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios -group=nagios --with-openssl=/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/n doutils1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:

Page 32: Centre On

- 32 -

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 community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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 st artup at 2,3,4 and 5 runlevel And reboot

Page 33: Centre On

- 33 -

2.9 Central: Install Centreon

Page 34: Centre On

- 34 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y

Page 35: Centre On

- 35 -

--------------------------------------------------- --------------------- Start CentWeb Installation --------------------------------------------------- --------------------- Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory

Page 36: Centre On

- 36 -

default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc OK Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK

Page 37: Centre On

- 37 -

Change macros for dashboardBuilder.pl OK Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- ---------------------

Page 38: Centre On

- 38 -

Create /usr/local/centreon/www/install/install.conf .php OK 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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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]

Page 39: Centre On

- 39 -

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

Page 40: Centre On

- 40 -

Install : snmptt OK Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ################################################### ############################ # # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start

2.10 Central: Finishing setup of Centreon Connect via browser to http://yourcentral-ip/centreon

Page 41: Centre On

- 41 -

Page 42: Centre On

- 42 -

2.11 Central: Configuring webinterface

broker_module=

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

Page 43: Centre On

- 43 -

Correct the errors:

Page 44: Centre On

- 44 -

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).

Page 45: Centre On

- 45 -

Page 46: Centre On

- 46 -

2.13 Poller: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 poller000.localdomain.com pol ler000 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com central

Switch to fixed IP address vi /etc/network/interfaces

Page 47: Centre On

- 47 -

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 it’s 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, it’s time to install the appropriate tools (it’s 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

Page 48: Centre On

- 48 -

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 dn sutils 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/nag ios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/"

Page 49: Centre On

- 49 -

2.16 Poller: Nagios Plugins setup cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug /nagiosplug/1.4.15/nagios-plugins-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 --with-openssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios ALL=NOPASSWD: /etc/init.d/nagios restart nagios ALL=NOPASSWD: /etc/init.d/nagios stop nagios ALL=NOPASSWD: /etc/init.d/nagios start nagios ALL=NOPASSWD: /etc/init.d/nagios reload nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios tats nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios * nagios ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db * 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* rest art CENTREON ALL = NOPASSWD: /etc/init.d/nagios resta rt # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* relo ad CENTREON ALL = NOPASSWD: /etc/init.d/nagios reloa d # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd re start # 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

Page 50: Centre On

- 50 -

cd /usr/local/src wget http://prdownloads.sourceforge.net/sourceforge/nagi os/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz cd ndoutils-1.4b9 wget http://svn.centreon.com/trunk/ndoutils-patch/ndouti ls1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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

Page 51: Centre On

- 51 -

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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 ru nlevel and reboot

Page 52: Centre On

- 52 -

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

Page 53: Centre On

- 53 -

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 nag ios@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 [email protected] 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:0 8:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/n o)? yes Warning: Permanently added '10.77.0.49' (RSA) to th e list of known hosts. [email protected]'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 w eren'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 [email protected]

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/* [email protected]:/usr/local/nagios/ libexec scp /usr/local/nagios/bin/ndomod.o [email protected]:/usr/local/nagios/ bin if you encounter access denied errors like: scp: /usr/local/nagios/libexec/check_dhcp: Permissi on 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 *

Page 54: Centre On

- 54 -

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

Page 55: Centre On

- 55 -

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

Page 56: Centre On

- 56 -

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

Page 57: Centre On

- 57 -

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).

Page 58: Centre On

- 58 -

Choose only ssh server

3.2 MySql: First login Login and become root: login as: cristian [email protected]'s password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Th u 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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#

Page 59: Centre On

- 59 -

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 localhost 127.0.1.1 mysql-cent.localdomain.com my sql-cent 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com central 10.77.3.122 mysql-cent.localdomain.com 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

Page 60: Centre On

- 60 -

3.3 MySql: Necessary components System update

Once it’s 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, it’s time to install the appropriate tools (it’s up to you).

System aptitude install sysutils sysv-rc-conf policykit nt p -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 libsnm p-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:

Page 61: Centre On

- 61 -

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 62: Centre On

- 62 -

Check Apache2, mysql, snmpd to startup at 2,3,4 an d 5 runlevel and reboot

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 :* LISTEN 1080/mysqld

Page 63: Centre On

- 63 -

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).

Page 64: Centre On

- 64 -

Page 65: Centre On

- 65 -

3.8 Central: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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

Page 66: Centre On

- 66 -

System load: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 central.localdomain.com centr al 10.77.3.120 central.localdomain.com centr al 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.122 mysql-cent.localdomain.com 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 it’s installed, proceed with a system update

Page 67: Centre On

- 67 -

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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5 aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v 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.

Page 68: Centre On

- 68 -

/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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-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 --with-openssl=/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

Page 69: Centre On

- 69 -

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

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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'

Page 70: Centre On

- 70 -

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 community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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.

Page 71: Centre On

- 71 -

3.15 Central: Install Centreon Remember if you have not done before:

Page 72: Centre On

- 72 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y --------------------------------------------------- ---------------------

Page 73: Centre On

- 73 -

Start CentWeb Installation --------------------------------------------------- --------------------- Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory default to [/usr/local/nagios/etc]

Page 74: Centre On

- 74 -

> Path /usr/local/nagios/etc OK Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK Change macros for dashboardBuilder.pl OK

Page 75: Centre On

- 75 -

Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- --------------------- Create /usr/local/centreon/www/install/install.conf .php OK

Page 76: Centre On

- 76 -

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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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] >

Page 77: Centre On

- 77 -

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

Page 78: Centre On

- 78 -

Install : snmpttconvertmib OK Create /etc/centreon/instCentPlugins.conf OK ################################################### ############################ # # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start 3.16 Central: Finishing setup of Centreon

Page 79: Centre On

- 79 -

Page 80: Centre On

- 80 -

Page 81: Centre On

- 81 -

Page 82: Centre On

- 82 -

3.17 MySql: Configure centreon user of mysql from any hosts

Service centcore restart

Page 83: Centre On

- 83 -

Service centstorage restart

3.18 MySql: Reset admin password Search for admin user of centreon in database and reset all informations

Insert this password: 5f4dcc3b5aa765d61d8327deb882 cf99 ( that is ‘password’)

Page 84: Centre On

- 84 -

3.19 Central: Configuring webinterface Then enter centreon webinterface and retype the pas sword for centreon user of mysql server in nd02db configurati on:

Page 85: Centre On

- 85 -

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).

Page 86: Centre On

- 86 -

Page 87: Centre On

- 87 -

3.21 Poller: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 poller000.localdomain.com pol ler000 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com 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):

Page 88: Centre On

- 88 -

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 it’s 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, it’s time to install the appropriate tools (it’s 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

Page 89: Centre On

- 89 -

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 dn sutils 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/nag ios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/

Page 90: Centre On

- 90 -

wget http://downloads.sourceforge.net/project/nagiosplug /nagiosplug/1.4.15/nagios-plugins-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 --with-openssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios ALL=NOPASSWD: /etc/init.d/nagios restart nagios ALL=NOPASSWD: /etc/init.d/nagios stop nagios ALL=NOPASSWD: /etc/init.d/nagios start nagios ALL=NOPASSWD: /etc/init.d/nagios reload nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios tats nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios * nagios ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db * 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* rest art CENTREON ALL = NOPASSWD: /etc/init.d/nagios resta rt # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* relo ad CENTREON ALL = NOPASSWD: /etc/init.d/nagios reloa d # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd re start # 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/nagi os/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz

Page 91: Centre On

- 91 -

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

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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 community

#com2sec paranoid default public

com2sec readonly default public

Page 92: Centre On

- 92 -

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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 ru nlevel and reboot

Page 93: Centre On

- 93 -

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

Page 94: Centre On

- 94 -

$ 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 nag ios@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 [email protected] 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:0 8:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/n o)? yes Warning: Permanently added '10.77.0.49' (RSA) to th e list of known hosts. [email protected]'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 w eren'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 [email protected]

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/* [email protected]:/usr/local/nagios/ libexec scp /usr/local/nagios/bin/ndomod.o [email protected]:/usr/local/nagios/ bin if you encounter access denied errors like: scp: /usr/local/nagios/libexec/check_dhcp: Permissi on denied

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

Page 95: Centre On

- 95 -

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)

Page 96: Centre On

- 96 -

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

Page 97: Centre On

- 97 -

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 :

Page 98: Centre On

- 98 -

Page 99: Centre On

- 99 -

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

Page 100: Centre On

- 100 -

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.

Page 101: Centre On

- 101 -

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).

Page 102: Centre On

- 102 -

Page 103: Centre On

- 103 -

5.2 Central: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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

Page 104: Centre On

- 104 -

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

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 it’s 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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5

Page 105: Centre On

- 105 -

aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v 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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --enable-event-broker

Page 106: Centre On

- 106 -

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/nagios-plugins-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 --with-openssl=/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/n doutils1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios Make

manual installation :

Page 107: Centre On

- 107 -

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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:56 68==> Central-Broker (TCP-IPv4)

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

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer au lien ci-dessous.

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

Page 108: Centre On

- 108 -

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.

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian

Ubuntu libqt4-dev

Qt (>= 4.5)

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-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:

Page 109: Centre On

- 109 -

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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description

WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are 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

Page 110: Centre On

- 110 -

• 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 résultat du make install pour avoir les chemins qui seront utile par la suite.

Page 111: Centre On

- 111 -

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

Page 112: Centre On

- 112 -

Edit snmpd configuration file:

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 113: Centre On

- 113 -

Check Apche2, MySQL , Nagios , central-broker, cent ral-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/"

Page 114: Centre On

- 114 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y --------------------------------------------------- --------------------- Start CentWeb Installation --------------------------------------------------- ---------------------

Page 115: Centre On

- 115 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc OK

Page 116: Centre On

- 116 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK Change macros for dashboardBuilder.pl OK Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl OK

Page 117: Centre On

- 117 -

--------------------------------------------------- --------------------- 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- --------------------- Create /usr/local/centreon/www/install/install.conf .php OK Create /etc/centreon/instCentWeb.conf OK --------------------------------------------------- ---------------------

Page 118: Centre On

- 118 -

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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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 OK /usr/bin/ssh OK

Page 119: Centre On

- 119 -

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

Page 120: Centre On

- 120 -

# # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start 5.11 Central: Finishing setup of Centreon Connect via browser to http://yourcentral-ip/centreon

Page 121: Centre On

- 121 -

Page 122: Centre On

- 122 -

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

• Compléter l’onglet "General"

Page 123: Centre On

- 123 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

Page 124: Centre On

- 124 -

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "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

Page 125: Centre On

- 125 -

Central-RRD

• Compléter l’onglet "General"

Page 126: Centre On

- 126 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

Page 127: Centre On

- 127 -

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 128: Centre On

- 128 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 129: Centre On

- 129 -

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 même temps que la config de Nagios. Il faut donc faire :

Page 130: Centre On

- 130 -

• Configuration -> Nagios : Générer et Déplacer

reboot

Troubleshooting

TODO

Les commandes utiles :

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

Permet de vérifier 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).

Page 131: Centre On

- 131 -

Page 132: Centre On

- 132 -

5.14 Poller: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 poller000.localdomain.com pol ler000 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com 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):

Page 133: Centre On

- 133 -

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 it’s 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, it’s time to install the appropriate tools (it’s 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

Page 134: Centre On

- 134 -

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 dn sutils 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/nag ios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/"

Page 135: Centre On

- 135 -

5.17 Poller: Nagios Plugins setup cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagiosplug /nagiosplug/1.4.15/nagios-plugins-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 --with-openssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios ALL=NOPASSWD: /etc/init.d/nagios restart nagios ALL=NOPASSWD: /etc/init.d/nagios stop nagios ALL=NOPASSWD: /etc/init.d/nagios start nagios ALL=NOPASSWD: /etc/init.d/nagios reload nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios tats nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios * nagios ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db * 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* rest art CENTREON ALL = NOPASSWD: /etc/init.d/nagios resta rt # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* relo ad CENTREON ALL = NOPASSWD: /etc/init.d/nagios reloa d # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd re start # 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

Page 136: Centre On

- 136 -

wget http://prdownloads.sourceforge.net/sourceforge/nagi os/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz cd ndoutils-1.4b9 wget http://svn.centreon.com/trunk/ndoutils-patch/ndouti ls1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:56 68==> Central-Broker (TCP-IPv4)

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

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer au lien ci-dessous.

Page 137: Centre On

- 137 -

• 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.

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian

Ubuntu libqt4-dev

Qt (>= 4.5)

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-dev cd etc mkdir centreon

Page 138: Centre On

- 138 -

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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description

WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are 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.

Page 139: Centre On

- 139 -

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 résultat du make install pour avoir les chemins qui seront utile par la suite.

Page 140: Centre On

- 140 -

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/

Page 141: Centre On

- 141 -

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 community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

Or more simply :

vi /etc/snmp/snmpd.conf

delete all the content of this file and type: rocommunity public service snmpd restart

Page 142: Centre On

- 142 -

5.21 Poller: Check services sysv-rc-conf

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

Page 143: Centre On

- 143 -

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 nag ios@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 [email protected] 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:0 8:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/n o)? yes Warning: Permanently added '10.77.0.49' (RSA) to th e list of known hosts. [email protected]'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 w eren'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 [email protected]

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/* [email protected]:/usr/local/nagios/ libexec

Page 144: Centre On

- 144 -

scp /usr/local/nagios/bin/ndomod.o [email protected]:/usr/local/nagios/ bin if you encounter access denied errors like: scp: /usr/local/nagios/libexec/check_dhcp: Permissi on 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:

Page 145: Centre On

- 145 -

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

Désactivation de NDO

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg

Page 146: Centre On

- 146 -

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

• Compléter l’onglet "General"

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Page 147: Centre On

- 147 -

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "TCP - Ipv4"

Page 148: Centre On

- 148 -

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

Page 149: Centre On

- 149 -

Central-RRD

• Compléter l’onglet "General"

Page 150: Centre On

- 150 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

Page 151: Centre On

- 151 -

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

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 152: Centre On

- 152 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 153: Centre On

- 153 -

Export des fichiers de config

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

• Configuration -> Nagios : Générer et Déplacer

reboot

Page 154: Centre On

- 154 -

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).

Page 155: Centre On

- 155 -

Choose only ssh server

6.2 MySql: First login Login and become root: login as: cristian [email protected]'s password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Th u 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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

Page 156: Centre On

- 156 -

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 localhost 127.0.1.1 mysql-cent.localdomain.com my sql-cent 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com central 10.77.3.122 mysql-cent.localdomain.com 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

Page 157: Centre On

- 157 -

6.3 MySql: Necessary components System update

Once it’s 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, it’s time to install the appropriate tools (it’s up to you).

System aptitude install sysutils sysv-rc-conf policykit nt p -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 libsnm p-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:

Page 158: Centre On

- 158 -

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 159: Centre On

- 159 -

Check Apache2, mysql, snmpd to startup at 2,3,4 an d 5 runlevel and reboot

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 :* LISTEN 1080/mysqld

Page 160: Centre On

- 160 -

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).

Page 161: Centre On

- 161 -

Page 162: Centre On

- 162 -

6.8 Central: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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

Page 163: Centre On

- 163 -

System load: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 central.localdomain.com centr al 10.77.3.120 central.localdomain.com centr al 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.122 mysql-cent.localdomain.com 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 it’s installed, proceed with a system update

Page 164: Centre On

- 164 -

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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5 aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v 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.

Page 165: Centre On

- 165 -

/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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-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 --with-openssl=/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

Page 166: Centre On

- 166 -

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

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:56 68==> Central-Broker (TCP-IPv4)

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

Page 167: Centre On

- 167 -

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer 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.

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian Qt (>= 4.5)

Ubuntu libqt4-dev

Page 168: Centre On

- 168 -

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description

WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are 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 .

Page 169: Centre On

- 169 -

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 résultat du make install pour avoir les chemins qui seront utile par la suite.

Page 170: Centre On

- 170 -

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

Page 171: Centre On

- 171 -

Edit snmpd configuration file:

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 172: Centre On

- 172 -

Check Apche2, MySQL , Nagios , central-broker, cent ral-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/"

Page 173: Centre On

- 173 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y --------------------------------------------------- --------------------- Start CentWeb Installation --------------------------------------------------- ---------------------

Page 174: Centre On

- 174 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc OK

Page 175: Centre On

- 175 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK Change macros for dashboardBuilder.pl OK Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl OK

Page 176: Centre On

- 176 -

--------------------------------------------------- --------------------- 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- --------------------- Create /usr/local/centreon/www/install/install.conf .php OK Create /etc/centreon/instCentWeb.conf OK --------------------------------------------------- ---------------------

Page 177: Centre On

- 177 -

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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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 OK /usr/bin/ssh OK

Page 178: Centre On

- 178 -

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

Page 179: Centre On

- 179 -

# # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start 6.17 Central: Finishing setup of Centreon

Page 180: Centre On

- 180 -

Page 181: Centre On

- 181 -

Page 182: Centre On

- 182 -

Page 183: Centre On

- 183 -

6.18 MySql: Configure centreon user of mysql from any hosts

Service centcore restart

Page 184: Centre On

- 184 -

Service centstorage restart

6.19 MySql: Reset admin password Search for admin user of centreon in database and reset all informations

Insert this password: 5f4dcc3b5aa765d61d8327deb882 cf99 ( that is ‘password’)

Page 185: Centre On

- 185 -

6.20 Central: Configuring Centreon to use Centreon-Broker cd /usr/local/centreon/log

mkdir centreon-broker

chmod 777 –R centreon-broker

Désactivation de NDO

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg

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

Page 186: Centre On

- 186 -

Disable / remove ndo2db service

Activation de Centreon-Broker

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

Central-Broker

• Compléter l’onglet "General"

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Page 187: Centre On

- 187 -

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "TCP - Ipv4"

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

Page 188: Centre On

- 188 -

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

Page 189: Centre On

- 189 -

Central-RRD

• Compléter l’onglet "General"

Page 190: Centre On

- 190 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

Page 191: Centre On

- 191 -

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

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 192: Centre On

- 192 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 193: Centre On

- 193 -

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 même temps que la config de Nagios. Il faut donc faire :

Page 194: Centre On

- 194 -

• Configuration -> Nagios : Générer et Déplacer

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).

Page 195: Centre On

- 195 -

6.22 Poller: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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

Page 196: Centre On

- 196 -

System load: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 poller000.localdomain.com pol ler000 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com 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:

Page 197: Centre On

- 197 -

System update

Once it’s 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, it’s time to install the appropriate tools (it’s 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 dn sutils 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

Page 198: Centre On

- 198 -

/usr/sbin/usermod -a -G nagios www-data cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nag ios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-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 --with-openssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios ALL=NOPASSWD: /etc/init.d/nagios restart nagios ALL=NOPASSWD: /etc/init.d/nagios stop nagios ALL=NOPASSWD: /etc/init.d/nagios start nagios ALL=NOPASSWD: /etc/init.d/nagios reload nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios tats

Page 199: Centre On

- 199 -

nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios * nagios ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db * 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* rest art CENTREON ALL = NOPASSWD: /etc/init.d/nagios resta rt # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* relo ad CENTREON ALL = NOPASSWD: /etc/init.d/nagios reloa d # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd re start # 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/nagi os/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz cd ndoutils-1.4b9 wget http://svn.centreon.com/trunk/ndoutils-patch/ndouti ls1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg chmod 777 /usr/local/nagios/bin/ *

Page 200: Centre On

- 200 -

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:56 68==> Central-Broker (TCP-IPv4)

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

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer 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, ...).

Page 201: Centre On

- 201 -

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.

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian

Ubuntu libqt4-dev

Qt (>= 4.5)

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-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.

Page 202: Centre On

- 202 -

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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description

WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are 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

Page 203: Centre On

- 203 -

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 résultat 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

Page 204: Centre On

- 204 -

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

Page 205: Centre On

- 205 -

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 206: Centre On

- 206 -

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

Page 207: Centre On

- 207 -

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 nag ios@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 [email protected] 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:0 8:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/n o)? yes Warning: Permanently added '10.77.0.49' (RSA) to th e list of known hosts. [email protected]'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 w eren'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 [email protected]

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/* [email protected]:/usr/local/nagios/ libexec

Page 208: Centre On

- 208 -

scp /usr/local/nagios/bin/ndomod.o [email protected]:/usr/local/nagios/ bin if you encounter access denied errors like: scp: /usr/local/nagios/libexec/check_dhcp: Permissi on 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:

Page 209: Centre On

- 209 -

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

Page 210: Centre On

- 210 -

Disable / remove ndo2db service

Activation de Centreon-Broker

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

Central-Broker

• Compléter l’onglet "General"

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Page 211: Centre On

- 211 -

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "TCP - Ipv4"

Page 212: Centre On

- 212 -

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

Page 213: Centre On

- 213 -

Central-RRD

• Compléter l’onglet "General"

Page 214: Centre On

- 214 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

Page 215: Centre On

- 215 -

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

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 216: Centre On

- 216 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 217: Centre On

- 217 -

Export des fichiers de config

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

• Configuration -> Nagios : Générer et Déplacer

reboot

Page 218: Centre On

- 218 -

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).

Page 219: Centre On

- 219 -

Choose only ssh server

7.2 MySql: First login Login and become root: login as: cristian [email protected]'s password: Linux mysql-cent 2.6.32-33-server #70-Ubuntu SMP Th u 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: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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

Page 220: Centre On

- 220 -

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 localhost 127.0.1.1 mysql-cent.localdomain.com my sql-cent 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com central 10.77.3.122 mysql-cent.localdomain.com 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

Page 221: Centre On

- 221 -

7.3 MySql: Necessary components System update

Once it’s 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, it’s time to install the appropriate tools (it’s up to you).

System aptitude install sysutils sysv-rc-conf policykit nt p -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 libsnm p-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:

Page 222: Centre On

- 222 -

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 223: Centre On

- 223 -

Check Apache2, mysql, snmpd to startup at 2,3,4 an d 5 runlevel and reboot

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 :* LISTEN 1080/mysqld

Page 224: Centre On

- 224 -

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).

Page 225: Centre On

- 225 -

Page 226: Centre On

- 226 -

7.8 Central1: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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

Page 227: Centre On

- 227 -

System load: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 central.localdomain.com centr al 10.77.3.120 central.localdomain.com centr al 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.122 mysql-cent.localdomain.com 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 it’s installed, proceed with a system update

Page 228: Centre On

- 228 -

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, it’s time to install the appropriate tools (it’s up to you). System aptitude install sysutils policykit ntp -y

Web and php5 aptitude install apache2 apache2-mpm-prefork libapa che2-mod-php5 -y aptitude install php5 php5-mysql mysql-server libmy sqlclient-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-d es-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y

SNMP aptitude install snmp snmpd libnet-snmp-perl libsnm p-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-de v 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.

Page 229: Centre On

- 229 -

/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/nagio s/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-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 --with-openssl=/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

Page 230: Centre On

- 230 -

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

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg 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:56 68==> Central-Broker (TCP-IPv4)

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

Page 231: Centre On

- 231 -

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer 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.

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian Qt (>= 4.5)

Ubuntu libqt4-dev

Page 232: Centre On

- 232 -

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description

WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are 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 .

Page 233: Centre On

- 233 -

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 résultat du make install pour avoir les chemins qui seront utile par la suite.

Page 234: Centre On

- 234 -

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

Page 235: Centre On

- 235 -

Edit snmpd configuration file:

vi /etc/snmp/snmpd.conf

and change this section:

# sec.name source community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 236: Centre On

- 236 -

Check Apche2, MySQL , Nagios , central-broker, cent ral-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/"

Page 237: Centre On

- 237 -

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.co m) # # Thanks for using Centreo n # # # # v2.3 # # # # [email protected] # # # # Make sure you have installed an d configured # # sudo - sed - php - apache - rrd tool - 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 proces s [y/n], default to [n]: > y --------------------------------------------------- --------------------- Start CentWeb Installation --------------------------------------------------- ---------------------

Page 238: Centre On

- 238 -

Where is your Centreon directory? default to [/usr/local/centreon] > Do you want me to create this directory ? [/usr/loc al/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/loc al/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/cen treon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon generation_files directory? default to [/usr/local/centreon] > Path /usr/local/centreon OK 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/loc al/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 OK /usr/bin/rrdtool OK /usr/bin/mail OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK Where is installed Nagios ? default to [/usr/local/nagios] > Path /usr/local/nagios OK Where is your nagios config directory default to [/usr/local/nagios/etc] > Path /usr/local/nagios/etc OK

Page 239: Centre On

- 239 -

Where is your Nagios var directory ? default to [/usr/local/nagios/var] > Path /usr/local/nagios/var OK Where is your Nagios plugins (libexec) directory ? default to [/usr/local/nagios/libexec] > Path /usr/local/nagios/libexec OK /usr/local/nagios/bin//nagios OK Where is your Nagios image directory ? default to [/usr/local/nagios/share/images/logos] > > Path /usr/local/nagios/share/images/logos OK /usr/local/nagios/bin//nagiostats OK p1_file : /usr/local/nagios/bin/p1.pl OK /usr/bin/php OK /usr/bin/perl OK Finding Apache group : www-data Finding Apache user : www-data Finding Nagios user : nagios Finding Nagios group : nagios /usr/local/nagios/bin//ndomod.o OK --------------------------------------------------- --------------------- Configure Sudo --------------------------------------------------- --------------------- Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK Nagios init script OK Your sudo is not configured Do you want me to configure your sudo ? (WARNING) [y/n], default to [n]: > y Configuring Sudo OK --------------------------------------------------- --------------------- Configure Apache server --------------------------------------------------- --------------------- Do you want to add Centreon Apache sub configuratio n 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 OK Preparing Centreon temporary files Change right on /usr/local/centreon/log OK Change right on /etc/centreon OK Change right on /usr/local/nagios/share/images/logo s OK Install nagios documentation OK Change macros for insertBaseConf.sql OK Change macros for php files OK Change right on /usr/local/nagios/etc OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Install libraries OK Copying libinstall OK Change macros for centreon.cron OK Install Centreon cron.d file OK Change macros for centAcl.php OK Change macros for downtimeManager.php OK Change macros for eventReportBuilder.pl OK Change macros for dashboardBuilder.pl OK Install cron directory OK Change right for eventReportBuilder.pl OK Change right for dashboardBuilder.pl OK

Page 240: Centre On

- 240 -

--------------------------------------------------- --------------------- 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 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.1 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK Check PEAR modules PEAR 1.4.9 1.9.4 OK DB 1.7.6 1.7.14 OK DB_DataObject 1.8.4 1.9.6 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.1 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK HTML_Common 1.2.2 1.2.5 OK HTML_QuickForm 3.2.5 3.2.13 OK HTML_QuickForm_advmultiselect 1.1.0 1.5.1 OK HTML_Table 1.6.1 1.8.3 OK Archive_Tar 1.1 1.3.3 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.2.3 OK Net_SMTP 1.2.8 1.6.1 OK Net_Socket 1.0.1 1.0.10 OK Net_Traceroute 0.21 0.21.3 OK Net_Ping 2.4.1 2.4.5 OK Validate 0.6.2 0.8.5 OK XML_RPC 1.4.5 1.5.5 OK SOAP 0.10.1 0.13.0 OK Log 1.9.11 1.12.7 OK All PEAR modules OK --------------------------------------------------- --------------------- Centreon Post Install --------------------------------------------------- --------------------- Create /usr/local/centreon/www/install/install.conf .php OK Create /etc/centreon/instCentWeb.conf OK --------------------------------------------------- ---------------------

Page 241: Centre On

- 241 -

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 OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Finding Nagios group : nagios Finding Nagios user : nagios Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/stat us' OK Creating Centreon Directory '/var/lib/centreon/metr ics' OK Change macros for centstorage binary OK Install CentStorage binary OK Install library for centstorage OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Do you want me to install CentStorage init script ? [y/n], default to [n]: >y CentStorage init script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: >y update-rc.d: warning: /etc/init.d/centstorage missi ng LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScr ipts> Adding system startup for /etc/init.d/centstorage ... /etc/rc0.d/K30centstorage -> ../init.d/centstora ge /etc/rc1.d/K30centstorage -> ../init.d/centstora ge /etc/rc6.d/K30centstorage -> ../init.d/centstora ge /etc/rc2.d/S40centstorage -> ../init.d/centstora ge /etc/rc3.d/S40centstorage -> ../init.d/centstora ge /etc/rc4.d/S40centstorage -> ../init.d/centstora ge /etc/rc5.d/S40centstorage -> ../init.d/centstora ge 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 OK /usr/bin/ssh OK

Page 242: Centre On

- 242 -

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

Page 243: Centre On

- 243 -

# # # Go to the URL : http://central.do main.com/centreon/ # # to finish the setup # # # # Report bugs at http://forge.cent reon.com # # # # Thanks for using Centreon . # # ----------------------- # # Contact : [email protected] om # # 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 won’t start 7.17 Central1: Finishing setup of Centreon

Page 244: Centre On

- 244 -

Page 245: Centre On

- 245 -

Page 246: Centre On

- 246 -

Page 247: Centre On

- 247 -

7.18 MySql: Configure centreon user of mysql from any hosts

Service centcore restart

Page 248: Centre On

- 248 -

Service centstorage restart

7.19 MySql: Reset admin password Search for admin user of centreon in database and reset all informations

Insert this password: 5f4dcc3b5aa765d61d8327deb882 cf99 ( that is ‘password’)

Page 249: Centre On

- 249 -

7.20 Central1: Configuring Centreon to use Centreon-Broker cd /usr/local/centreon/log

mkdir centreon-broker

chmod 777 –R centreon-broker

Désactivation de NDO

Configuration -> Centreon -> ndo2db.cfg : disable! Disable also ndomod.cfg

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

Page 250: Centre On

- 250 -

Disable / remove ndo2db service

Activation de Centreon-Broker

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

Central-Broker

• Compléter l’onglet "General"

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Page 251: Centre On

- 251 -

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "TCP - Ipv4"

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

Page 252: Centre On

- 252 -

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

Page 253: Centre On

- 253 -

Central-RRD

• Compléter l’onglet "General"

Page 254: Centre On

- 254 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

Page 255: Centre On

- 255 -

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

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 256: Centre On

- 256 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 257: Centre On

- 257 -

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 même temps que la config de Nagios. Il faut donc faire :

Page 258: Centre On

- 258 -

• Configuration -> Nagios : Générer et Déplacer

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).

Page 259: Centre On

- 259 -

7.22 Poller: First login Login and become root: login as: cristian [email protected]'s password: Linux central 2.6.32-33-server #70-Ubuntu SMP Thu J ul 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

Page 260: Centre On

- 260 -

System load: 0.15 Processes: 73 Usage of /: 10.8% of 7.49GB Users logged in: 1 Memory usage: 5% IP address for et h0: 10.77.0.83 Swap usage: 0% 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 localhost 127.0.1.1 poller000.localdomain.com pol ler000 10.77.3.121 poller000.localdomain.com pol ler000 10.77.3.120 central.localdomain.com 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

Page 261: Centre On

- 261 -

Once it’s 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, it’s time to install the appropriate tools (it’s 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 dn sutils 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

Page 262: Centre On

- 262 -

cd /usr/local/src/ wget http://downloads.sourceforge.net/project/nagios/nag ios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz tar -xzf nagios-3.3.1.tar.gz cd nagios ./configure --prefix=/usr/local/nagios --with-comma nd-group=nagios --enable-nanosleep --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/nagios-plugins-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 --with-openssl=/usr/bin/openssl --enable-perl-modules make make install cd /usr/local/nagios chmod 777 -R libexec vi /etc/sudoers nagios ALL=NOPASSWD: /etc/init.d/nagios restart nagios ALL=NOPASSWD: /etc/init.d/nagios stop nagios ALL=NOPASSWD: /etc/init.d/nagios start nagios ALL=NOPASSWD: /etc/init.d/nagios reload nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios tats nagios ALL=NOPASSWD: /usr/local/nagios/bin/nagios * nagios ALL=NOPASSWD: /usr/local/nagios/bin/ndo2db *

Page 263: Centre On

- 263 -

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* rest art CENTREON ALL = NOPASSWD: /etc/init.d/nagios resta rt # Nagios reload CENTREON ALL = NOPASSWD: /etc/init.d/nagios* relo ad CENTREON ALL = NOPASSWD: /etc/init.d/nagios reloa d # Nagios test config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -v * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -v * # Nagios test for optim config CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios* -s * CENTREON ALL = NOPASSWD: /usr/local/nagios/bin/na gios -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd re start # 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/nagi os/ndoutils-1.4b9.tar.gz tar -xzf ndoutils-1.4b9.tar.gz cd ndoutils-1.4b9 wget http://svn.centreon.com/trunk/ndoutils-patch/ndouti ls1.4b9_light.patch patch -p1 -N < ndoutils1.4b9_light.patch

configuration and installation ./configure --prefix=/usr/local/nagios/ --enable-my sql --disable-pgsql \ --with-ndo2db-user=nagios --with-ndo2db-group=na gios 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.c fg cp ndomod.cfg-sample /usr/local/nagios/etc/ndomod.c fg chmod 777 /usr/local/nagios/bin/ * chown nagios:nagios /usr/local/nagios/bin/ndo*

Page 264: Centre On

- 264 -

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:56 68==> Central-Broker (TCP-IPv4)

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

Central-Broker (TCP-IPv4) ==> Central-Broker (Perfd ata) ==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 Ge nerator) ==File_system==> Folder of metrics and status

Comment compiler Centreon-Broker

Pour la partie Compilation merci de se référer 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.

Page 265: Centre On

- 265 -

Software OS Version Package Name Debian

Ubuntu build-essential

C++ compilation environment

Red Hat gcc-c++, make

Debian

Ubuntu CMake (>= 2.8)

Red Hat

cmake

Debian

Ubuntu libqt4-dev

Qt (>= 4.5)

Red Hat qt4-devel

Debian

Ubuntu librrd-dev

RRDTool development files

Red Hat rrdtool-devel

With Debian or Ubuntu

You need to run:

apt-get install build-essential cmake libqt4-dev li brrd-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>=<val ue2>] .

Here's the list of variables available and their description:

Variable Description WITH_PREFIX Base directory for Centreon Broker installation. If other prefixes are

Page 266: Centre On

- 266 -

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

Page 267: Centre On

- 267 -

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 résultat 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

Page 268: Centre On

- 268 -

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 community

#com2sec paranoid default public

com2sec readonly default public

com2sec readonly 127.0.0.1 public

Page 269: Centre On

- 269 -

com2sec readonly 192.168.0.0/24 public

#com2sec readwrite default private

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

Page 270: Centre On

- 270 -

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

Page 271: Centre On

- 271 -

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 nag ios@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 [email protected] 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:0 8:4b:7b:31:ca:59:70. Are you sure you want to continue connecting (yes/n o)? yes Warning: Permanently added '10.77.0.49' (RSA) to th e list of known hosts. [email protected]'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 w eren'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 [email protected]

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/* [email protected]:/usr/local/nagios/ libexec

Page 272: Centre On

- 272 -

scp /usr/local/nagios/bin/ndomod.o [email protected]:/usr/local/nagios/ bin if you encounter access denied errors like: scp: /usr/local/nagios/libexec/check_dhcp: Permissi on 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:

Page 273: Centre On

- 273 -

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

Page 274: Centre On

- 274 -

Disable / remove ndo2db service

Activation de Centreon-Broker

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

Central-Broker

• Compléter l’onglet "General"

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Page 275: Centre On

- 275 -

Name : Central Master Connection port : 5668

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File" (il faut que l’arborescence existe sinon cbd se plantera)

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

• Compléter l’onglet "Output" avec l’ajout (dans l'ordre) d’un "SQL – Broker SQL Database", un "Storage – Perfdata Generator (Centreon Storage)" et d’un "TCP - Ipv4"

Page 276: Centre On

- 276 -

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

Page 277: Centre On

- 277 -

Central-RRD

• Compléter l’onglet "General"

Page 278: Centre On

- 278 -

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

• Compléter l’onglet "Input" avec l’ajout d’un "TCP -IPv4"

Name : RRD-Master Connection port : 5669

• Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

Page 279: Centre On

- 279 -

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

• Compléter l’onglet "Output" avec l’ajout d’un "RRD – RRD File Generator"

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

Central-Module

• Compléter l’onglet "General"

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

Page 280: Centre On

- 280 -

• Il n'y a pas d'input pour le module • Compléter l’onglet "Logger" avec l’ajout d’un "Core – File"

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

• Compléter l’onglet "Output" avec l’ajout d’un "TCP -IPv4"

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

Page 281: Centre On

- 281 -

Export des fichiers de config

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

• Configuration -> Nagios : Générer et Déplacer

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.

Page 282: Centre On

- 282 -

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 présent sur le serveur debian apt-get install curl install graphviz

Installation en ligne de commande Vous devez récupérer les binaires sur le site de la forge monitoring-fr Décompressez l'archive. cd /usr/local/src tar xzf centreon-nagvis-2.2b.tar.gz cd centreon-nagvis-2.2b

L'installation téléchargera automatiquement la dernière version de Nagvis si vous êtes connecté à Internet avec le serveur. Malheureusement dans certaine entreprise, vous n'avez pas accès à Internet

Page 283: Centre On

- 283 -

pour les serveurs. Dans ce cas, copiez l'archive de Nagvis, préalablement téléchargée, 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\`) VALUES ('ce ntreon-nagvis-db-password','$NAGVISPASS'); INSERT INTO options (\`key\`,\`value\`) VALUES ('ce ntreon-nagvis-db-user','$NAGVISUSER'); INSERT INTO options (\`key\`,\`value\`) VALUES ('ce ntreon-nagvis-db-name','$NAGVISDB'); INSERT INTO options (\`key\`,\`value\`) VALUES ('ce ntreon-nagvis-db-port','$MYSQLPORT'); INSERT INTO options (\`key\`,\`value\`) VALUES ('ce ntreon-nagvis-db-host','$MYSQLHOST');" sqlclean="DROP TABLE IF EXISTS $CENTREONDB.centreon nagvis; DROP DATABASE IF EXISTS $NAGVISDB;" sqlcentreon="use $CENTREONDB; CREATE TABLE centreo nnagvis ( acl_group_id int(10) NOT NULL, roleId int(10) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=lat in1;" sqlacl="GRANT ALL PRIVILEGES ON $NAGVISDB.* to '$NA GVISUSER'@'$LOCALMACHINE' identified by '$NAGVISPASS'; GRANT SELECT on $CENTREONDB.centreonnagvis to '$NAG VISUSER'@'$LOCALMACHINE'; GRANT SELECT on $CENTREONDB.acl_groups to '$NAGVISU SER'@'$LOCALMACHINE'; GRANT SELECT on $CENTREONDB.session to '$NAGVISUSER '@'$LOCALMACHINE';

Page 284: Centre On

- 284 -

GRANT SELECT on $CENTREONDB.acl_group_contacts_rela tions to '$NAGVISUSER'@'$LOCALMACHINE'; GRANT SELECT on $CENTREONDB.contact to '$NAGVISUSER '@'$LOCALMACHINE'; GRANT SELECT on $NAGVISDB.roles to '$CENTREONUSER'@ '$LOCALMACHINE'; FLUSH PRIVILEGES;" sqlnagvisdb="CREATE DATABASE IF NOT EXISTS $NAGVISD B 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 paramètres Apache HTTPD_USER="www-data" HTTPD_GROUP="www-data" HTTPD_CONF="/etc/apache2/conf.d" HTTPD_INIT="/etc/init.d/apache2"

Page 285: Centre On

- 285 -

Ces lignes correspondent aux paramétrages 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 paramétrages de Nagvis, normalement il faut laisser par défaut. 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"

Paramètre du broker ndoutils, le paramètre NAGVISLIVE ne sera pas utilisé NAGVISBACKENDS="ndo2db" NAGVISNDO="/usr/local/nagios/bin/ndo2db-3x" NAGVISLIVE="unix:/opt/monitor/var/rw/live"

Paramètres pour Nagios, normalement par défaut ENGINE="Nagios" ENGINEPATH="/usr/local/nagios" ENGINEBIN="/usr/local/nagios/bin/nagios" GRAPHVIZBIN="/usr/bin"

Il reste à saisir les paramètres pour Mysql, et la création 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 tabl e Checking database nagvis Checking centreon module /usr/local/centreon/www/m odules/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--

Page 286: Centre On

- 286 -

http://downloads.sourceforge.net/project/nagvis/Nag Vis%201.5/nagvis-1.5.9.tar.gz Résolution de downloads.sourceforge.net... 216.34.1 81.59, 216.34.181.59 Connexion vers downloads.sourceforge.net|216.34.181 .59|:80...connecté. requête HTTP transmise, en attente de la réponse... 302 Found Emplacement: http://freefr.dl.sourceforge.net/project/nagvis/Nag Vis%201.5/nagvis-1.5.9.tar.gz [suivant] --2011-07-24 19:47:04-- http://freefr.dl.sourceforge.net/project/nagvis/Nag Vis%201.5/nagvis-1.5.9.tar.gz Résolution de freefr.dl.sourceforge.net... 88.191.2 50.132 Connexion vers freefr.dl.sourceforge.net|88.191.250 .132|:80...connecté. requête HTTP transmise, en attente de la réponse... 200 OK Longueur: 3298253 (3,1M) [application/x-gzip] Sauvegarde en : «nagvis-1.5.9.tar.gz» 100%[============================================== =>] 3 298 253 315K/s ds 9,3s 2011-07-24 19:47:14 (347 KB/s) - «nagvis-1.5.9.tar. gz» sauvegardé [3298253/3298253] installing nagvis

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 créer un utilisateur standard dans Centreon.

Création des utilisateurs Nous allons créer un utilisateur supervision qui fera partie du groupe de contact niveau1. Celui-ci recevra les autorisations pour la vue Nagvis et l'accès aux ressources. Ce groupe sera limité à la vue dans Nagvis en lecture seule. Un groupe d'accès nagvisRO sera initialisé pour correspondre au groupe Read-Only de Nagvis. Il faudra créer 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'accès nagvisRW sera initialisé pour correspondre au groupe Administrators de Nagvis.

Création du groupe de contact niveau1.

Page 287: Centre On

- 287 -

Liste des groupes de contacts

Création de l'utilisateur supervision associé au groupe niveau1

Celui-ci n'est pas administrateur. Faire de même pour l'utilisateur exploitant et son groupe de contact associé niveau2

Liste des utilisateurs

Page 288: Centre On

- 288 -

Configuration des ACL de Centreon Maintenant, créez deux groupes d'accès nagvisRW et nagvisRO.

supervision et niveau1 devront être sélectionnés pour le groupe d'accès nagvisRO

exploitant et niveau2 devront être sélectionnés pour le groupe d'accès nagvisRW Nous donnerons accès aux menus de Centreon avec les groupes d'accès aux Menus MNUniveau1 et MNUniveau2.

Page 289: Centre On

- 289 -

Le niveau 1 aura une vue limitée au monitoring en temps réel de la supervision. Ne pas oublier d'associer le groupe d'accès nagvisRO.

Page 290: Centre On

- 290 -

Le niveau 2 aura une vue plus étendue. Ne pas oublier d'associer le groupe d'accès nagvisRW.

Ensuite nous utiliserons un groupe d'accès aux ressources nommé All Ressources (celui créé par défaut lors de l'installation de Centreon) et nous ajouterons les deux groupes d'accès nagvisRW et nagvisRO.

Page 291: Centre On

- 291 -

Pour information, nous créerons le groupe d'accès aux actions pour le niveau2 et nous ajouterons le groupe d'accès nagvisRW. Les actions permises par ce groupe seront cochées dans la liste proposée.

Configuration du mappage Nagvis-Centreon Nos ACL étant créés, nous devons associer chaque groupe d'accès à un groupe de Nagvis. Sélectionnez 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.

Vérification Et voila, votre module est fonctionnel. Vous pouvez le tester en vous connectant en exploitant. La vue Nagvis est parfaitement intégrée dans l'interface Centreon.

Page 292: Centre On

- 292 -

Un conseil, n'oublier pas de changer le mot de passe par défaut de l'administrateur nagiosadmin proposé par Nagvis.

Utilisation des utilisateurs en lecture seule Dernière chose à paramétrer, un utilisateur Nagvis en lecture seule. Si vous vous connectez en supervision sans ce dernier paramétrage 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 remédier, se connecter en administrateur (par exemple en exploitant). Sélectionnez le menu User Menu / Manage Users

Page 293: Centre On

- 293 -

Créer l'utilisateur supervision ou tout autre nom.

Lui affecter le rôle Users (read-only). N'oubliez pas de sauvegarder et quitter l'interface. Vous pouvez utiliser sans problème 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 paramètres (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 développement php5. apt-get install libssh2-1-dev php5-dev apt-get install libssh2-php apache2ctl -k graceful pecl install -f ssh2-beta

On récupère 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

Page 294: Centre On

- 294 -

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/ssh 2.ini echo "extension=ssh2.so" > /etc/php5/apache2/conf.d /ssh2.ini

Redémarrer le serveur apache /etc/init.d/apache2 restart

Vérifions l'activation de ssh2 php -i |grep ssh Registered PHP Streams => zip, php, file, data, htt p, 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 serve ur de supervision Vous devez récupérer 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

Décompresser l'archive dans /usr/local/src et lancer l'installation ################################################### ############################ # # # http://forge.centreon.com/projects/show /centreon-syslog # # Thanks for using Centreo n # # # # 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

Page 295: Centre On

- 295 -

You will now read Centreon Syslog module Licence. Press enter to continue.

Vérification des pré requis, appuyer sur Entrée This General Public License does not permit incorpo rating your program into proprietary programs. If your program is a subrout ine library, you may consider it more useful to permit linking proprieta ry applications with the library. If this is what you want to do, use the G NU 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 "instCent Web.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 fi nished 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/cent reon-syslog/issues/new # # # ################################################### ############################

L'installation en ligne de commande est terminée

Installation du module dans Centreon Il faut se connecter à l'interface Web de centreon

Page 296: Centre On

- 296 -

Sélectionnez Administration / Modules. Cliquez sur l'icône à droite pour installer le module.

Cliquez sur le bouton Install Modules

L'installation s'est bien passée, cliquer sur le bouton back.

Page 297: Centre On

- 297 -

L'installation du module est terminée, vous pouvez accéder à 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 réaliser 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 succ ès

Sélectionnez Administration / Modules.

Page 298: Centre On

- 298 -

Cliquez sur Configuration

Cliquez sur Modify pour modifier la configuration

Page 299: Centre On

- 299 -

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

Page 300: Centre On

- 300 -

Le fichier a bien été envoyé. Attention, il y a un problème 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 données affichées ! 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 paramètre bind-address et relancer le serveur Mysql /etc/init.d/mysql restart

Page 301: Centre On

- 301 -

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 journée actuelle n'est pas encore présente. Il faudra attendre 23 h 59 pour que le script /usr/bin/syslog/tableLogRotate.php s'exécute. Il y a possiblité de forcer son exécution 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

Page 302: Centre On

- 302 -

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 créée, vous pouvez retourner sur Centreon et visualiser les logs.

Vous avez la possibilité de filtrer sur une période de date et d'exporter au format csv ou open office.

Mise en place de la coloration syntaxique des événe ments Pour bénéficier de la coloration des événements 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 dernière ligne comme ci-dessous. $template sysMysql,"INSERT INTO logs (host,facility , priority,level,tag,datetime,program,msg) VALUES ('%HOSTNAME%','%syslogfacility-text%','%sysl ogpriority-text%','%syslogseverity%', '%syslogtag%', '%timereported:::date-mysql%','%prog ramname%', '%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

Page 303: Centre On

- 303 -

Les champs se remplissent aussitôt avec du texte, le champ Severity change de couleur en fonction de la criticité de l'événement comme ci-dessous.

L'installation de notre Syslog est terminée. Pour effectuer une éventuelle mise à jour du module, visiter cette page. Il restera à compléter l'installation du module de langue français. Nous allons, maintenant, aborder la centralisation des événements windows par l'intermédiaire de Centreon E2S. 8.3 geolocation