WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

Mise sur pied d'une solution de supervision- réseaux

( Télécharger le fichier original )
par Rodrigue YOSSA
Institut africain d'informatique représentation du Cameroun - En vue de l'obtention du diplôme d'ingénieur des travaux informatiques 2009
  

précédent sommaire suivant

Extinction Rebellion

II-V-5-f) Installation de Centreon

Afin de faciliter la communication entre nagios et Centreon, nous créons une base de données « ndo » et utiliserons le plugin NDOUtils.

II-V-5-f-1) Pré requis

Création de la base de données ndo

# mysqladmin -u root -p create ndo

# mysql -u root -p mysql

Installation de phpmyadmin pour manipuler les bases de données (Surtout pour donner tous les droits sur la base ndo à l'utilisateur nagios).

# apt-get install phpmyadmin

II-V-5-f-2) Installation de NDOUtils.

Téléchargeons et compilons les sources de NDOUtils

# cd /usr/src/

# wget http://dfn.dl.sourceforge.net/sourceforge/nagios/ndoutils-1.4b8.tar.gz

# tar zxvf ndoutils-1.4b8.tar.gz

# cd ndoutils-1.4b8.tar.gz

# ./configure -disable-pgsql -with-mysql-lib=/usr/lib/mysql -with-ndo2db-user=Nagios -with-ndo2db-group=nagiosgrp

# make

# cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o

# cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db

Modifions le fichier de nagios :

# gedit /usr/local/nagios/etc/nagios.cfg

event_broker_options=-1

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

# cp config/ndomod.cfg /usr/local/nagios/etc/

Modifions le fichier ndomod.cfg :

# gedit /usr/local/nagios/etc/ndomod.cfg

instance_name=Central

output_type=unixsocket

output=/usr/local/nagios/var/ndo.sock

tcp_port=5668

output_buffer_items=5000

buffer_file=/usr/local/nagios/var/ndomod.tmp

# cp config/ndo2db.cfg /usr/local/nagios/etc/

Modifions le fichier ndo2db.cfg :

# gedit /usr/local/nagios/etc/ndo2db.cfg

ndo2db_user=nagios

ndo2db_group=nagiosgrp

socket_type=unix

socket_name=/usr/local/nagios/var/ndo.sock

tcp_port=5668

db_servertype=mysql

db_host=localhost

db_name=ndo

db_port=3306

db_prefix=nagios_

db_user=ndouser

db_pass=ndopassword

Rattrapons les droits sur les fichiers :

# chmod 774 /usr/local/nagios/bin/ndo*

# chown nagios:nagiosgrp /usr/local/nagios/bin/*

# chown nagios:nagiosgrp /usr/local/nagios/etc/ndo*

Initialisons la base de données :

# ./installdb -u nagios -p nagios -h localhost -d ndo

Automatisons le lancement de ndo2db pour qu'il se lance au démarrage du serveur en créant le fichier /etc/init.d/ndo2db et en y copiant le script suivant :

#!/bin/sh

#

#

# chkconfig: 345 99 01

# description: Nagios to mysql

#

# Author : Ga«tan Lucas

# Realase : 07/02/08

# Version : 0.1 b

# File : ndo2db

# Description: Starts and stops the Ndo2db daemon

# used to provide network services status in a database.

#

status_ndo ()

{

if ps -p $NdoPID > /dev/null 2>&1; then

return 0

else

return 1

fi

return 1

}

printstatus_ndo()

{

if status_ndo $1 $2; then

echo "ndo (pid $NdoPID) is running..."

else

echo "ndo is not running"

fi

}

killproc_ndo ()

{

echo "kill $2 $NdoPID"

kill $2 $NdoPID

}

pid_ndo ()

{

if test ! -f $NdoRunFile; then

echo "No lock file found in $NdoRunFile"

echo -n " checking runing process..."

NdoPID=`ps h -C ndo2db -o pid`

if [ -z "$NdoPID" ]; then

echo " No ndo2db process found"

exit 1

else

echo " found process pid: $NdoPID"

echo -n " reinit $NdoRunFile ..."

touch $NdoRunFile

chown $NdoUser:$NdoGroup $NdoRunFile

echo "$NdoPID" > $NdoRunFile

echo " done"

fi

fi

NdoPID=`head $NdoRunFile`

}

# Source function library

# Solaris doesn't have an rc.d directory, so do a test first

if [ -f /etc/rc.d/init.d/functions ]; then

. /etc/rc.d/init.d/functions

elif [ -f /etc/init.d/functions ]; then

. /etc/init.d/functions

fi

prefix=/usr/local/nagios

exec_prefix=${prefix}

NdoBin=${exec_prefix}/bin/ndo2db

NdoCfgFile=${prefix}/etc/ndo2db.cfg

NdoRunFile=${prefix}/var/ndo2db.run

NdoLockDir=/var/lock/subsys

NdoLockFile=ndo2db.lock

NdoUser=nagios

NdoGroup=nagcmd

# Check that ndo exists.

if [ ! -f $NdoBin ]; then

echo "Executable file $NdoBin not found. Exiting."

exit 1

fi

# Check that ndo.cfg exists.

if [ ! -f $NdoCfgFile ]; then

echo "Configuration file $NdoCfgFile not found. Exiting."

exit 1

fi

# See how we were called.

case "$1" in

start)

echo -n "Starting ndo:"

touch $NdoRunFile

chown $NdoUser:$NdoGroup $NdoRunFile

$NdoBin -c $NdoCfgFile

if [ -d $NdoLockDir ]; then

touch $NdoLockDir/$NdoLockFile;

fi

ps h -C ndo2db -o pid > $NdoRunFile

if [ $? -eq 0 ]; then

echo " done."

exit 0

else

echo " failed."

$0 stop

exit 1

fi

;;

stop)

echo -n "Stopping ndo: "

pid_ndo

killproc_ndo

# now we have to wait for ndo to exit and remove its

# own NdoRunFile, otherwise a following "start" could

# happen, and then the exiting ndo will remove the

# new NdoRunFile, allowing multiple ndo daemons

# to (sooner or later) run

#echo -n 'Waiting for ndo to exit .'

for i in 1 2 3 4 5 6 7 8 9 10 ; do

if status_ndo > /dev/null; then

echo -n '.'

sleep 1

else

break

fi

done

if status_ndo > /dev/null; then

echo

echo 'Warning - ndo did not exit in a timely manner'

else

echo 'done.'

fi

rm -f $NdoRunFile $NdoLockDir/$NdoLockFile

;;

status)

pid_ndo

printstatus_ndo ndo

;;

restart)

$0 stop

$0 start

;;

*)

echo "Usage: ndo {start|stop|restart|status}"

exit 1

;;

esac

# End of this script

Rendons le script exécutable :

Commande : # chown root:root /etc/init.d/ndo2db

Commande : # chmod 755 /etc/init.d/ndo2db

Commande : # update-rc.d ndo2db defaults

Commande : # /etc/init.d/ndo2db start

Relançons nagios :

Commande : # /etc/init.d/nagios restart

...

...

done

Puis on télécharge les sources de Centreon sur sourgeforge.net que l'on déplacera dans /usr/src/

Commande : # cp /media/THEYOS/centreon-2.0.2.tar.gz /usr/src/

Allons décompresser l'archive.

# tar zxvf centreon-2.0.2.tar.gz

# cd centreon-2.0.2

Lançons l'assistant en répondant à toutes les questions, qui sont régulièrement des confirmations de répertoire

# ./install.sh -i

...

...

...

...

Where is your NDO ndomod binary ?

default to [/usr/sbin/ndomod.o]> /usr/local/nagios/bin/ndomod.o

...

...

...

Attendre que tout évolue jusqu'à la fin de l'initialisation de l'installation.

Initialisation de Centreon complète

Il est conseillé d'optimiser la base de données ndo

# cd /usr/src/centreon-2.0.2/www/install

# mysql -u root -p ndo < ./createNDODB.sql

# mysql -u root -p

Puis grâce à phpmyadmin on donne tous les droits à l'utilisateur Nagios sur la base « ndo ». Reste plus qu'à poursuivre l'installation de Centreon via l'interface web en ouvrant notre navigateur et en tapant http://localhost/centreon/ puis suivre l'assistant.

Cliquer sur « next »

Renseigner les champs

Fournir les informations

Désactivons l'authentification LDAP

Cliquer pour compléter l'installation

Ceci nous redirigera vers la page de login.

Page de login

précédent sommaire suivant






Extinction Rebellion





Changeons ce systeme injuste, Soyez votre propre syndic





"Un démenti, si pauvre qu'il soit, rassure les sots et déroute les incrédules"   Talleyrand