Depuis la compatibilité de Centreon UI 2.6.0 avec PHP 5.4, installer Centreon est devenu un jeu d’enfant, enfin, presque… Cette article présente l’installation d’une supervision Nagios en utilisant les paquets Debian et Centreon 2.6.0. Nous utiliserons le broker Centreon pour faire le lien entre le moteur Nagios et l’interface Web Centreon.
L’installation est réalisée avec la version Wheezy de Debian. Il est possible d’utiliser la dernière version Jessie, j’indique les modifications à réaliser.
Attention, cette solution devient de plus en plus obsolète, Nagios n’étant plus proposé dans le choix du moteur dans l’interface de Centreon depuis la version 2.6.1.
1 – Installation de Nagios
2 – Installation de Centreon-Broker
3 – Installation du protocole SNMP
4 – Installation de Centreon UI
5 – Installation en mode Web
6 – Configuration des services
$ sudo -s password : #
.
Installation de Nagios
L’installation de Nagios est « on ne peut plus simple ». Lancez la commande suivante :
# aptitude install nagios3
Le programme d’installation demande le mot de passe de nagiosadmin pour l’interface Web.

Confirmez.

L’installation terminée, votre supervision est opérationnelle. Lancez l’url suivante http://IP_du_Nagios/nagios3. Saisissez le nom de l’utilisateur nagiosadmin ainsi que son mot de passe associé et vous aurez la vue suivante en sélectionnant Current Status / Services

.
Installation de Centreon-Broker

L’équipe de Centreon a développé son propre broker plus modulaire et plus performant que celui proposé par Nagios, NDOutil. Il est depuis peu compatible avec Nagvis grâce à un connecteur spécifique. Actuellement, Centreon-Broker est à la version 2.8.2. Elle est comptatible avec la version de Centreon 2.6x. Les installations de Centreon-Broker 2.4x à 2.6x sont pratiquement identiques.
Ce chapitre présente l’installation de Centreon-broker version 2.8, c’est la suite pour l’installation finale de Centreon 2.6.x. Nous installerons la dernière version 2.8.2.
Pré requis
Tout d’abord, Il faudra créer un groupe système et un utilisateur système centreon-broker. Ceci est obligatoire pour installer l’interface Web de Centreon.
# groupadd -g 6002 centreon-broker # useradd -u 6002 -g centreon-broker -m -r -d /var/lib/centreon-broker -c "Centreon-broker Admin" centreon-broker
# aptitude install build-essential cmake librrd-dev libqt4-dev libqt4-sql-mysql libgnutls-dev lsb-release -y
# cd /usr/local/src # wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon-broker/centreon-broker-2.8.2.tar.gz # tar xzvf centreon-broker-2.8.2.tar.gz # cd /usr/local/src/centreon-broker-2.8.2/build/
# cmake \ -DWITH_DAEMONS='central-broker;central-rrd' \ -DWITH_GROUP=centreon-broker \ -DWITH_PREFIX=/usr \ -DWITH_PREFIX_BIN=/usr/sbin \ -DWITH_PREFIX_CONF=/etc/centreon-broker \ -DWITH_PREFIX_LIB=/usr/lib/centreon-broker \ -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker \ -DWITH_STARTUP_DIR=/etc/init.d \ -DWITH_STARTUP_SCRIPT=auto \ -DWITH_TESTING=0 \ -DWITH_USER=centreon-broker .
-- Configuration Summary -- --------------------- -- -- Project -- - Name Centreon Broker -- - Version 2.8.2 -- -- System -- - Name Linux -- - Version 3.16.0-4-amd64 -- - Processor x86_64 -- -- Build -- - Compiler /usr/bin/c++ (GNU) -- - Extra compilation flags -- - Qt 4.8.2 -- - Unit tests disabled -- - Startup script sysv -- - Module stats, neb, file, compression, correlation, dumper, local, rrd, sql, storage, bam, tcp, tls, bbdo, ndo -- -- Install -- - Prefix /usr -- - Binary prefix /usr/sbin -- - Library prefix /usr/lib/centreon-broker -- - Modules prefix /usr/share/centreon/lib/centreon-broker -- - Include prefix /usr/include/centreon-broker -- - Configuration prefix /etc/centreon-broker -- - Startup dir /etc/init.d -- - User centreon-broker -- - Group centreon-broker -- - Package None -- -- Configuring done -- Generating done -- Build files have been written to: /usr/local/src/centreon-broker-2.8.2/build
# make # make install
# update-rc.d cbd defaults
L’installation de Centreon-Broker est terminée, il faut passer à l’installation de Centreon. Si vous n’avez pas configuré SNMP, il est temps de le faire.
.
Installation du protocole SNMP
Pré requis
Installons les paquets supplémentaires.
# aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl -y
Paramétrages
Pour le fonctionnement du SNMP, modifiez le fichier /etc/snmp/snmpd.conf
# vim /etc/snmp/snmpd.conf agentAddress udp:localhost:161 rocommunity public localhost
Pour éviter d’avoir un deamon snmpd trop bavard, (réduction des logs), et pour recevoir les traps modifier le fichier /etc/default/snmpd
# vim /etc/default/snmpd # snmpd options (use syslog, close stdin/out/err). SNMPDOPTS='-LS4d -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
# aptitude install snmp-mibs-downloader -y # ln -s /usr/share/mibs/ /usr/share/snmp/mibs
Modifiez le fichier /etc/default/snmpd
# vim /etc/default/snmpd #mibs ALL export MIBDIRS=/usr/share/snmp/mibs export MIBS=ALL
# service snmpd restart
# snmpwalk -c public -v 2c localhost
Vous devez obtenir une très longue liste d’OID SNMP. Seul bémol, les OID de type HrSWInstalled (.1.3.6.1.2.1.25.6) ne sont pas pris en compte. C’est gênant pour certains plugins fournis par Centreon. Je n’ai pas trouvé la solution pour pallier ce problème.
.
Installation de Centreon UI

Tout d’abord, Il faudra créer un groupe et un utilisateur centreon
# groupadd -g 6000 centreon # useradd -u 6000 -g centreon -m -r -d /var/lib/centreon -c "Centreon Admin" centreon
# aptitude install sudo tofrodos bsd-mailx lsb-release mysql-server libmysqlclient-dev apache2 apache2-mpm-prefork php5 php5-mysql php-pear php5-ldap php5-snmp php5-gd rrdtool librrds-perl libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha-perl libgd-gd2-perl php5-sqlite -y
# cd /usr/local/src # wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon/centreon-2.6.0.tar.gz # tar xzf centreon-2.6.0.tar.gz # cd centreon-2.6.0
./install.sh -i ############################################################################### # # # Centreon (www.centreon.com) # # Thanks for using Centreon # # # # v2.6.0 # # # # infos@centreon.com # # # # Make sure you have installed and configured # # sudo - sed - php - apache - rrdtool - mysql # # # ############################################################################### ------------------------------------------------------------------------ Checking all needed binaries ------------------------------------------------------------------------ rm OK cp OK mv OK /bin/chmod OK /bin/chown OK echo OK more OK mkdir OK find OK /bin/grep OK /bin/cat OK /bin/sed OK You will now read Centreon Licence. Press enter to continue. This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Do you accept GPL license ? [y/n], default to [n]: > y ------------------------------------------------------------------------ Please choose what do you want to install ------------------------------------------------------------------------ Do you want to install Centreon Web Front [y/n], default to [n]: > y Do you want to install Centreon CentCore [y/n], default to [n]: > y Do you want to install Centreon Nagios Plugins [y/n], default to [n]: > y Do you want to install Centreon Snmp Traps process [y/n], default to [n]: > y ------------------------------------------------------------------------ Start CentWeb Installation ------------------------------------------------------------------------ Where is your Centreon directory? default to [/usr/local/centreon] > /usr/share/centreon Path /usr/share/centreon OK Ici on nous demande le répertoire de stockage des journaux/logs de centreon. Where is your Centreon log directory default to [/usr/local/centreon/log] > /var/log/centreon Do you want me to create this directory ? [/var/log/centreon] [y/n], default to [n]: > y Path /var/log/centreon OK Where is your Centreon etc directory default to [/etc/centreon] > Do you want me to create this directory ? [/etc/centreon] [y/n], default to [n]: > y Path /etc/centreon OK Where is your Centreon binaries directory default to [/usr/local/centreon/bin] > /usr/share/centreon/bin Do you want me to create this directory ? [/usr/share/centreon/bin] [y/n], default to [n]: > y Path /usr/share/centreon/bin OK Where is your Centreon data informations directory default to [/usr/local/centreon/data] > /usr/share/centreon/data Do you want me to create this directory ? [/usr/share/centreon/data] [y/n], default to [n]: > y Path /usr/share/centreon/data 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 /usr/bin/rrdtool OK /usr/bin/mail OK /usr/bin/php OK Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > Path /usr/share/php OK /usr/bin/perl OK Finding Apache user : www-data Finding Apache group : www-data What is the Centreon group ? [centreon] default to [centreon] > What is the Centreon user ? [centreon] default to [centreon] > What is the Monitoring engine user ? > nagios What is the Broker user ? (optional) > centreon-broker What is the Monitoring engine log directory ? > /var/log/nagios3 Where is your monitoring plugins (libexec) directory ? default to [/usr/lib/nagios/plugins] > Path /usr/lib/nagios/plugins OK Add group centreon to user www-data OK Add group centreon to user centreon-engine OK Add group centreon-engine to user www-data OK Add group centreon-engine to user centreon OK ------------------------------------------------------------------------ Configure Sudo ------------------------------------------------------------------------ Where is sudo configuration file default to [/etc/sudoers] > /etc/sudoers OK What is the Monitoring engine init.d script ? > /etc/init.d/nagios3 What is the Monitoring engine binary ? > /usr/sbin/nagios3 What is the Monitoring engine configuration directory ? > /etc/nagios3 Where is the configuration directory for broker module ? > /etc/centreon-broker Where is the init script for broker module daemon ? > /etc/init.d/cbd 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 configuration file ? [y/n], default to [n]: > y Create '/etc/apache2/conf.d/centreon.conf' OK Configuring Apache OK Do you want to reload your Apache ? [y/n], default to [n]: > y Reloading Apache service OK Preparing Centreon temporary files Change right on /var/log/centreon OK Change right on /etc/centreon OK Change macros for insertBaseConf.sql OK Change macros for sql update files OK Change macros for php files OK Change macros for perl binary OK Change right on /etc/centreon-engine OK Add group centreon-broker to user www-data OK Add group centreon-broker to user centreon-engine OK Add group centreon to user centreon-broker OK Change right on /etc/centreon-broker OK Copy CentWeb in system directory Install CentWeb (web front of centreon) OK Change right for install directory Change right for install directory OK Install libraries OK Write right to Smarty Cache 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 Install cron directory OK Change right for eventReportBuilder OK Change right for dashboardBuilder OK Change macros for centreon.logrotate OK Install Centreon logrotate.d file OK Prepare centFillTrapDB OK Install centFillTrapDB OK Prepare centreon_trap_send OK Install centreon_trap_send OK Prepare centreon_check_perfdata OK Install centreon_check_perfdata OK Prepare centreonSyncPlugins OK Install centreonSyncPlugins OK Prepare centreonSyncArchives OK Install centreonSyncArchives OK Install generateSqlLite OK Install changeRrdDsName.pl OK Prepare export-mysql-indexes OK Install export-mysql-indexes OK Prepare import-mysql-indexes OK Install import-mysql-indexes OK Centreon Web Perl lib installed OK ------------------------------------------------------------------------ Pear Modules ------------------------------------------------------------------------ Check PEAR modules PEAR 1.4.9 1.9.5 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 Archive_Tar 1.1 1.3.12 OK Auth_SASL 1.0.1 NOK Console_Getopt 1.2 1.3.1 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 Archive_Zip 0.1.2 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.8.2 OK DB_DataObject 1.8.4 1.11.4 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK MDB2 2.0.0 2.4.1 OK Auth_SASL 1.0.1 1.0.6 OK Net_SMTP 1.2.8 1.6.2 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.8 OK Archive_Zip 0.1.2 0.1.2 OK Check PEAR modules PEAR 1.4.9 1.9.5 OK DB 1.7.6 1.8.2 OK DB_DataObject 1.8.4 1.11.4 OK DB_DataObject_FormBuilder 1.0.0RC4 1.0.2 OK MDB2 2.0.0 2.4.1 OK Date 1.4.6 1.4.7 OK Archive_Tar 1.1 1.3.12 OK Auth_SASL 1.0.1 1.0.6 OK Console_Getopt 1.2 1.3.1 OK Net_SMTP 1.2.8 1.6.2 OK Net_Socket 1.0.1 1.0.14 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.8 OK Archive_Zip 0.1.2 0.1.2 OK All PEAR modules OK ------------------------------------------------------------------------ Centreon Post Install ------------------------------------------------------------------------ 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/share/centreon/bin] > Path /usr/share/centreon/bin OK Where is your CentStorage RRD directory default to [/var/lib/centreon] > Path /var/lib/centreon OK Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/status' OK Creating Centreon Directory '/var/lib/centreon/metrics' OK Install CentStorage binary OK Change right : /var/run/centreon OK Change macros for centstorage init script OK Replace Centstorage default script Macro OK Do you want me to install CentStorage init script ? [y/n], default to [n]: > y CentStorage init script installed OK CentStorage default script installed OK Do you want me to install CentStorage run level ? [y/n], default to [n]: > y update-rc.d: using dependency based boot sequencing CentStorage Perl lib installed OK Install logAnalyser OK Install logAnalyserBroker OK Install nagiosPerfTrace OK Change macros for centstorage.cron OK Install CentStorage cron OK Change macros for centstorage.logrotate OK Install Centreon Storage logrotate.d file OK Create /etc/centreon/instCentStorage.conf OK ------------------------------------------------------------------------ Start CentCore Installation ------------------------------------------------------------------------ Where is your CentCore binary directory default to [/usr/share/centreon/bin] > Path /usr/share/centreon/bin OK Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Copy CentCore in binary directory OK Change right : /var/run/centreon OK Change right : /var/lib/centreon OK Change macros for centcore.logrotate OK Install Centreon Core logrotate.d file OK Replace CentCore init script Macro OK Replace CentCore default script Macro OK Do you want me to install CentCore init script ? [y/n], default to [n]: > y CentCore init script installed OK CentCore default script installed OK Do you want me to install CentCore run level ? [y/n], default to [n]: > y update-rc.d: using dependency based boot sequencing CentCore Perl lib installed OK 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 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] > /etc/snmp OK Where is your CentreonTrapd binaries directory default to [/usr/local/centreon/bin] > /usr/share/centreon/bin/ /usr/share/centreon/bin/ OK Finding Apache user : www-data Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Change macros for snmptrapd.conf OK Replace CentreonTrapd init script Macro OK Replace CentreonTrapd default script Macro OK Do you want me to install CentreonTrapd init script ? [y/n], default to [n]: > y CentreonTrapd init script installed OK CentreonTrapd default script installed OK Do you want me to install CentreonTrapd run level ? [y/n], default to [n]: > y update-rc.d: using dependency based boot sequencing trapd Perl lib installed OK Install : snmptrapd.conf OK Install : centreontrapdforward OK Install : centreontrapd OK Create /etc/centreon/instCentPlugins.conf OK ############################################################################### # # # Go to the URL : http://debian7.localmac/centreon/ # # to finish the setup # # # # Report bugs at http://forge.centreon.com # # # # Thanks for using Centreon. # # ----------------------- # # Contact : infos@centreon.com # # http://www.centreon.com # # # ###############################################################################
.
Installation en mode Web
Avec Debian 8.0, il faut autoriser la configuration Centreon pour le serveur Web Apache
# a2enconf centreon.conf # service apache2 reload
Utilisez un navigateur internet récent et saisissez l’url suivante :
http://IP_du_server/centreon/

Démarrage de l’installation Web, cliquez sur “Next”

Validation des dépendances, cliquez sur “next”.

Nous choisirons comme moteur de supervision nagios. Saisissez les chemins ci-dessous.
Nagios directory : /usr/share/nagios3 Nagiostats binary : /usr/sbin/nagios3stats Nagios image directory : /usr/share/nagios3/htdocs/images Embedded Perl initialisation file : /usr/lib/nagios3/p1.pl
Cliquez sur Next. Auparavant, il faudra créer le dossier /var/log/centreon-broker et donner la permission au processus centengine d’écrire le fichier de statistique.
# mkdir /var/log/centreon-broker # chown centreon-broker:centreon-broker /var/log/centreon-broker # chmod 775 /var/log/centreon-broker # chmod 775 /var/lib/centreon-broker

Nous choisirons comme broker centreon-broker. Saisissez les chemins ci-dessous.
Centreon Broker etc directory: /etc/centreon-broker
Centreon Broker module (cbmod.so): /usr/lib/centreon-broker/cbmod.so
Centreon Broker log directory: /var/log/centreon-broker
Retention file directory: /var/lib/centreon-broker
Centreon Broker lib (*.so) directory: /usr/share/centreon/lib/centreon-broker
Cliquez sur Next

Création du user “Administrateur”, admin et son mot de passe. Saisir une adresse valide pour l’email. Cliquez sur Next.

Définir les Accès MySQL, le mot de passe de MySQL. Laisser les noms de base par défaut CENTREON, CENTSTORAGE et CENTSTATUS. Saisir le mot de passe pour ces bases de données. Avant de cliquez sur Next, modifiez le fichier de configuration de MySql /etc/mysql/my.cnf. Ajoutez la ligne suivante.
# vim /etc/mysql/my.cnf innodb_file_per_table=1
# service mysql restart
Cliquez sur Next

Cliquez sur Next

Fin de l’installation, cliquez sur Finish

Vous devriez avoir cette vue. Vous pouvez vous connecter à l’interface d’administration.
.
Configuration des services
# service centstorage start # service centcore start # service centreontrapd start # service apache2 reload
Connectez-vous à l’interface de Centreon. Sélectionnez le menu Configuration -> Monitoring Engines -> cgi. Modifiez la l’option Monitoring Engine process check command.
/usr/lib/nagios/plugins/check_nagios /var/log/nagios3/status.log 5 ”

Sélectionnez le menu Configuration -> Monitoring Engines -> main.cfg. Sélectionnez la configuration du moteur Nagios CFG 1. Modifiez l’option External Command File dans le premier onglet Files.
/var/lib/nagios3/rw/nagios.cmd

Pour évitez le message d’erreur lors de la génération des fichiers de configuration, modifiez les droits du dossier checkresults.
# chmod 775 /var/lib/nagios3/spool/checkresults

Pour générer la configuration, sélectionnez le menu Configuration / Monitoring Engines

# service cbd start
Au bout de quelques secondes, vous devriez voir apparaître les hôtes et services dans la barre d’état en haut à droite.

Voici la page des services en état pending. Toutefois l’hôte est en alerte car le plugin check_icmp ne peut être utilisé par l’utilisateur nagios. Il faut rajouter des droits supplémentaires pour deux plugins.

# chmod u+s /usr/lib/nagios/plugins/check_dhcp # chmod u+s /usr/lib/nagios/plugins/check_icmp
Votre serveur de supervision est en état de fonctionnement.

Gé-ni-al !!!
Tout simplement !
Un grand merci
Bonjour tout le monde
Je cherche un tuto pour installer nagios et centreon sur ubuntu 18.04,est ce que vous pouvez m’aidef
Merci d’avance