Configuration des droits centreon sur le serveur Satellite
visudo
## BEGIN: CENTREON SUDO # User_Alias CENTREON=www-data,centreon Defaults:CENTREON !requiretty # Monitoring engine Restart CENTREON ALL = NOPASSWD: /etc/init.d/centengine* restart CENTREON ALL = NOPASSWD: /etc/init.d/centengine restart # Monitoring engine reload CENTREON ALL = NOPASSWD: /etc/init.d/centengine* reload CENTREON ALL = NOPASSWD: /etc/init.d/centengine reload # Monitoring engine test config CENTREON ALL = NOPASSWD: /usr/local/centreon-engine/bin/centengine* -v * CENTREON ALL = NOPASSWD: /usr/local/centreon-engine/bin/centengine -v * # Monitoring engine test for optim config CENTREON ALL = NOPASSWD: /usr/local/centreon-engine/bin/centengine* -s * CENTREON ALL = NOPASSWD: /usr/local/centreon-engine/bin/centengine -s * # Snmptrapd Restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart # Snmptt restart CENTREON ALL = NOPASSWD: /etc/init.d/snmptt restart ## END: CENTREON SUDORelancer sudo
service sudo restart
Voici les commandes à appliquer :
cd /usr/local/plugins/libexec chown centreon:centreon-engine centreon* chown -R centreon:centreon-engine Centreon* chown centreon:centreon-engine check_centreon* chown centreon:centreon-engine check_snmp* chown centreon:centreon-engine submit* chown centreon:centreon-engine process* chmod 664 centreon.conf chmod +x centreon.pm chmod 2755 Centreon chmod 2755 Centreon/SNMP chmod +x Centreon/SNMP/Utils.pm chmod +x check_centreon* chmod +x check_snmp* chmod +x submit* chmod +x process*
chown centreon-broker: /usr/local/centreon-broker/etc chmod 775 /usr/local/centreon-broker/etc chown centreon: /usr/local/centreon-engine/etc/* chmod 775 /var/lib/centreon-broker
Création de la liaison entre le serveur Central et le satellite
Lancez une session centreon
root@supervision: su - centreon centreon@supervision:~$
centreon@supervision:~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/var/lib/centreon/.ssh/id_rsa): Created directory '/var/lib/centreon/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /var/lib/centreon/.ssh/id_rsa. Your public key has been saved in /var/lib/centreon/.ssh/id_rsa.pub. The key fingerprint is: 1d:a3:3d:c6:13:22:af:6a:46:6f:c2:50:a2:53:3c:25 centreon@nagios344cent The key's randomart image is: +--[ RSA 2048]----+ | | | E . | | . o . . + | | = . o * + | | o + S B | |o . . . . o | | . + .. | | =.o | | o.o | +-----------------+
Copions la clé sur le serveur satellite.
centreon@supervision:~$ ssh-copy-id -i .ssh/id_rsa.pub centreon@172.17.2.132 The authenticity of host '172.17.2.132 (172.17.2.132)' can't be established. RSA key fingerprint is 54:59:b3:7e:40:57:31:b8:ff:68:36:ed:ca:06:d1:6f. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.17.2.132' (RSA) to the list of known hosts. centreon@172.17.2.132's password: Now try logging into the machine, with "ssh 'centreon@172.17.2.132'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
centreon@supervision:~$ ssh centreon@172.17.2.132 Linux satellite 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Configuration du serveur Central
Ajout du poller
Saisir les informations suivantes
Poller Name : satellite IP Address : 172.17.2.132IP du serveur Satellite Localhost ? : No Is default poller ? : No SSH port : 22 Engine : Centreon Engine Monitoring Engine Init Script : /etc/init.d/centengine Monitoring Engine Binay: /usr/local/centreon-engine/bin/centengine Monitoring Engine Statistics Binary : /usr/local/centreon-engine/bin/centenginestats Perfdata file : /var/log/centreon-engine/service-perfdata Centreon Broker configuration path : /usr/local/centreon-broker/etc Centreon Broker modules path : /usr/local/centreon-broker/lib/centreon-broker Centreon Connector path : /usr/local/centreon-connector SNMPTT init script path : /etc/init.d/snmptt
./centreon -u admin -p password -o INSTANCE -a ADD -v "Satellite;172.17.2.132;22;CENGINE"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;init_script;/etc/init.d/centengine"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;nagios_bin;/usr/local/centreon-engine/bin/centengine"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;nagiostats_bin;/usr/local/centreon-engine/bin/centenginestats"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;nagios_perfdata;/var/log/centreon-engine/service-perfdata"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;centreonbroker_cfg_path;/usr/local/centreon-broker/etc"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;centreonbroker_module_path;/usr/local/centreon-broker/lib/centreon-broker"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;centreonconnector_path;/usr/local/centreon-connector"
./centreon -u admin -p password -o INSTANCE -a setparam -v "Satellite;init_script_snmptt;/etc/init.d/snmptt"
Vous devriez avoir deux pollers, le premier pour le serveur Central et le deuxième pour le serveur Satellite.
Ajout du module broker pour le serveur Satellite
Ajoutons le module Centreon-broker au serveur Satellite. Sélectionnez le menu Configuration / Centreon. Cliquez sur Configuration du menu gauche Centreon-broker. Ajoutons un module Centreon-Broker. Celui-ci devra envoyer ses données au serveur Central.
Onglet General
Saisir les informations suivantes
Name : satellite-module-master Config file name : satellite-module.xml Status : Enabled Requester : Satellite
./centreon -u admin -p password -o CENTBROKERCFG -a ADD -v "satellite-module-master;Satellite"
./centreon -u admin -p password -o CENTBROKERCFG -a SETPARAM -v "satellite-module-master;filename;satellite-module.xml"
Ajoutez un Core - File.
Saisir les informations suivantes
Name of the logger : /var/log/centreon-engine/satellite-module-master.log
./centreon -u admin -p password -o CENTBROKERCFG -a ADDLOGGER -v "satellite-module-master;/var/log/centreon-engine/satellite-module-master.log;file"
Ajoutez un Output TCP - IPv4 et un Output - File
Saisir les informations suivantes
TCP - IPv4 Name : satellite-module-output-master Host to connect to : 172.16.209.141 IP serveur Central Failover name : satellite-module-output-master-failover File Name : satellite-module-output-master-failover File path : /var/lib/centreon-engine/satellite-module-master.retention
./centreon -u admin -p password -o CENTBROKERCFG -a ADDOUTPUT -v "satellite-module-master;satellite-module-output-master;ipv4"
./centreon -u admin -p password -o CENTBROKERCFG -a SETOUTPUT -v "satellite-module-master;1;port;5669"
./centreon -u admin -p password -o CENTBROKERCFG -a SETOUTPUT -v "satellite-module-master;1;host;172.16.209.141"
./centreon -u admin -p password -o CENTBROKERCFG -a SETOUTPUT -v "satellite-module-master;1;failover;central-module-output-master-failover"
./centreon -u admin -p password -o CENTBROKERCFG -a ADDOUTPUT -v "satellite-module-master;central-module-output-master-failover;file"
./centreon -u admin -p password -o CENTBROKERCFG -a SETOUTPUT -v "satellite-module-master;2;path;/var/lib/centreon-engine/central-module-master.retention"
Ajoutez Statistics
Saisir les informations suivantes
Name : satellite-module-stat-master File path : /var/lib/centreon-broker/satellite-module-stat-master.pipe
Actuellement, la création du module statistique n'est pas supportée par Centreon-Clapi version 1.5
Vous devriez obtenir cette configuration ci-dessus.
Ajout du Monitoring Engine pour le serveur Satellite
Modifiez la configuration.
Onglet Files
Saisir les informations suivantes
Configuration Name : Satellite Engine CFG 1 Status : Enabled Linked poller : Satellite
Saisir les informations suivantes
Add a new broker module : /usr/local/centreon-broker/lib/cbmod.so /usr/local/centreon-broker/etc/satellite-module.xml
Création de l'hôte serveur Satellite
Sélectionnez Configuration / hôtes. Sélectionnez l'hôte exemple Centreon-Server et dupliquez-le.
Modifiez les paramètres suivant :
Host Name : Satellite
Alias : Monitoring Nagios
IP Address : 172.17.2.132
Monitored from : satellite
Voilà nos deux hôtes sont prêts, passons à la finalisation.
Application de la configuration
Vous devriez avoir cette fenêtre vous indiquant le bon déroulement des opérations.
Vérification du fonctionnement
tail -f /usr/local/centreon/log/centcore.log
On visualise l'activité de l'application de la configuration
2013-03-17 11:15:59 - Start: Send config files on poller 2
2013-03-17 11:15:59 - End: Send config files on poller 2
2013-03-17 11:16:02 - Init Script : 'sudo /etc/init.d/centengine restart' On poller 172.17.2.132 (2)
2013-03-17 11:16:02 - Engine : .centengine restart: done.
Pour vérifier le bon fonctionnement, il peut être intéressant de visualiser le dossier /usr/local/centreon-engine/etc. La nouvelle configuration a été appliquée. Nous continuerons bientôt sur l'installation distribuée avec Centreon-Broker.
Il est aussi intéressant de vérifier la communication du broker entre le Central et le satellite.
Communication côté Satellite
netstat -an | grep 5669
tcp 0 0 172.17.2.132:49697 172.16.209.141:5669 ESTABLISHED
Communication côté Central.
netstat -an | grep 5669
tcp 0 0 0.0.0.0:5669 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5669 127.0.0.1:42761 ESTABLISHED
tcp 0 0 127.0.0.1:42761 127.0.0.1:5669 ESTABLISHED
tcp 0 0 172.16.209.141:5669 172.2.17.132:46378 ESTABLISHED
On peut vérifier le fonctionnement de Centreon-Engine sur le serveur satellite en visualisant le fichier de log (/var/log/centreon-engine/centengine.log)
[1363515795] LOG VERSION: 2.0
[1363515795] Event broker module '/usr/local/centreon-engine/lib/centreon-engine/externalcmd.so' initialized successfully.
[1363515795] Centreon Broker: log applier: applying 1 logging objects
[1363515795] Event broker module '/usr/local/centreon-broker/lib/cbmod.so' initialized successfully.
[1363515795] INITIAL HOST STATE: Satellite;UP;HARD;1;OK - 172.16.209.177: rta 0,041ms, lost 0%
[1363515795] INITIAL SERVICE STATE: Satellite;Disk-/;OK;HARD;1;Disk OK - / TOTAL: 0.315GB USED: 0.119GB (37%) FREE: 0.196GB (63%)
[1363515795] INITIAL SERVICE STATE: Satellite;Load;OK;HARD;1;Load average: 0.00, 0.00, 0.00.
[1363515795] INITIAL SERVICE STATE: Satellite;Memory;OK;HARD;1;Total memory used : 9% ram used : 36%, swap used 0%
[1363515795] INITIAL SERVICE STATE: Satellite;Ping;OK;HARD;1;OK - 172.16.209.177: rta 0,023ms, lost 0%
Fonctionnement des pollers.
L'installation distribuée fonctionne correctement.