Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
informatique:linux:nagios [2008/11/17 14:50] benoit |
informatique:linux:nagios [2018/09/06 19:10] (Version actuelle) |
||
---|---|---|---|
Ligne 2: | Ligne 2: | ||
- | ===== Installation ===== | + | |
+ | |||
+ | |||
+ | ===== Installation du serveur ===== | ||
Ligne 26: | Ligne 29: | ||
- | ==== Compilation et installation du serveur ==== | + | |
+ | ==== Compilation et installation ==== | ||
tar xzf nagios-3.0.tar.gz | tar xzf nagios-3.0.tar.gz | ||
cd nagios-3.0 | cd nagios-3.0 | ||
Ligne 88: | Ligne 92: | ||
chkconfig --add nagios | chkconfig --add nagios | ||
chkconfig nagios on | chkconfig nagios on | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Ligne 94: | Ligne 103: | ||
==== Compilation et installation des plugins ==== | ==== Compilation et installation des plugins ==== | ||
- | Ajout des principaux plugins : | + | === Ajout des principaux plugins === |
tar xvzf nagios-plugins-1.4.11.tar.gz | tar xvzf nagios-plugins-1.4.11.tar.gz | ||
cd nagios-plugins-1.4.11 | cd nagios-plugins-1.4.11 | ||
Ligne 101: | Ligne 110: | ||
make install | make install | ||
- | Ajout du plugins NRPE | + | === Ajout du plugin NRPE (Nagios Remote Plugin Executor) === |
cd /usr/local/src | cd /usr/local/src | ||
tar xvzf nrpe-2.12.tar.gz | tar xvzf nrpe-2.12.tar.gz | ||
Ligne 114: | Ligne 123: | ||
chown nagios:nagios /usr/local/nagios/etc/nrpe.cfg | chown nagios:nagios /usr/local/nagios/etc/nrpe.cfg | ||
+ | Installation des scripts de démarrage | ||
+ | cp init-script /etc/init.d/nrpe | ||
+ | chmod 755 /etc/init.d/nrpe | ||
+ | | ||
+ | Configuration du lancement automatique | ||
+ | chkconfig --add nrpe | ||
+ | chkconfig --level 2345 nrpe on | ||
- | ==== Compilation et installation du client ==== | + | === Ajout du plugin NSCA (Nagios Service Check Acceptor) === |
+ | Installation NSCA | ||
- | === Installation de l'agent NRPE (Nagios Remote Plugin Executor) === | + | tar xvzf nsca-2.7.2.tar.gz |
+ | cd nsca-2.7.2 | ||
+ | ./configure | ||
+ | make all | ||
+ | mkdir /usr/local/nagios/nsca | ||
+ | cp src/nsca /usr/local/nagios/nsca/ | ||
+ | cp sample-config/nsca.cfg /usr/local/nagios/nsca/ | ||
+ | cp init-script /etc/init.d/nsca | ||
+ | chown -R nagios:nagios /usr/local/nagios/nsca/ | ||
+ | |||
+ | Configuration du lancement automatique | ||
+ | chkconfig --add nsca | ||
+ | chkconfig nsca on | ||
+ | |||
+ | === Ajout du plugin NDO === | ||
+ | Compilation | ||
+ | tar xvzf ndoutils-1.4b7.tar.gz | ||
+ | cd ndoutils-1.4b7 | ||
+ | ./configure | ||
+ | make | ||
+ | |||
+ | Installation | ||
+ | cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o | ||
+ | cp config/ndomod.cfg /usr/local/nagios/etc | ||
+ | cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db | ||
+ | cp config/ndo2db.cfg /usr/local/nagios/etc | ||
+ | |||
+ | Editer le fichier ''/usr/local/nagios/etc/nagios.cfg'' et ajouter la ligne suivante : | ||
+ | broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg | ||
+ | |||
+ | Editer le fichier ''/usr/local/nagios/etc/ndo2db.cfg'' et modifier les lignes suivantes : | ||
+ | db_user=nagios | ||
+ | db_pass=nagios | ||
+ | |||
+ | Création de base Mysql pour NDO : | ||
+ | mysql | ||
+ | create database nagios; | ||
+ | grant all privileges on nagios.* to nagios@localhost identified by 'nagios'; | ||
+ | quit | ||
+ | |||
+ | cd db | ||
+ | ./installdb -u nagios -p nagios -d nagios | ||
+ | |||
+ | Pour démarrer NDO : | ||
+ | /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg | ||
+ | |||
+ | |||
+ | |||
+ | ===== Installation du client ===== | ||
+ | |||
+ | |||
+ | ==== Pré-requis ==== | ||
+ | |||
+ | Création d'un user nagios, uid=706, gid=706, home=/home/nagios, password dans le fichier de conf. | ||
+ | |||
+ | adduser -u 706 -m nagios | ||
+ | |||
+ | Avant de commencer l'installation, installer les RPMs suivants : | ||
+ | * openssl | ||
+ | * openssl-devel | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== Installation ==== | ||
+ | === Installation du plugin NRPE === | ||
Compilation et installation : | Compilation et installation : | ||
cd /usr/local/src | cd /usr/local/src | ||
Ligne 132: | Ligne 215: | ||
chown nagios:nagios /usr/local/nagios/etc/nrpe.cfg | chown nagios:nagios /usr/local/nagios/etc/nrpe.cfg | ||
| | ||
+ | Installation des scripts de démarrage | ||
+ | cp init-script /etc/init.d/nrpe | ||
+ | chmod 755 /etc/init.d/nrpe | ||
+ | | ||
+ | Configuration du lancement automatique | ||
+ | chkconfig --add nrpe | ||
+ | chkconfig --level 2345 nrpe on | ||
+ | |||
+ | === Installation des principaux plugins === | ||
+ | |||
+ | Installer les packages suivant : | ||
+ | * perl-Net-SNMP-4.1.2-9.0.el5.noarch.rpm | ||
+ | * perl-Digest-HMAC-1.01-2.2.el5.rf.noarch.rpm | ||
+ | * perl-Crypt-DES-2.05-3.2.el5.rf.x86_64.rpm | ||
+ | * perl-Digest-SHA1-2.11-1.el5.rf.x86_64.rpm | ||
+ | |||
+ | Dans le répertoire /usr/local/src, en compte root : | ||
+ | tar xvzf nagios-plugins-1.4.11.tar.gz | ||
+ | chown -R nagios:nagios nagios-plugins-1.4.11/ | ||
+ | cd nagios-plugins-1.4.11 | ||
+ | ./configure --with-nagios-user=nagios --with-nagios-group=nagios | ||
+ | make | ||
+ | make install | ||
+ | |||
+ | === Installation de NSCA === | ||
+ | |||
+ | == Pré-requis == | ||
+ | Installation de libmcrypt nécessaire pour NSCA | ||
+ | Tar zxvf libmcrypt-2.5.8/ | ||
+ | Cd libmcrypt-2.5.8/ | ||
+ | ./configure | ||
+ | make | ||
+ | make check (pas d.erreur) | ||
+ | make install | ||
+ | |||
+ | Ajout dans la lib dynamique : | ||
+ | creation du fichier /etc/ld.so.conf.d/local_lib.conf qui doit contenir /usr/local/lib | ||
+ | |||
+ | Recharge du cache de lien dynamique : | ||
+ | ldconfig /etc/ld.so.conf | ||
+ | |||
+ | Verification que libmcrypt est bien résolu : | ||
+ | ldconfig -p | grep libmcrypt | ||
+ | |||
+ | |||
+ | == Installation de NSCA == | ||
+ | |||
+ | tar xvzf nsca-2.7.2.tar.gz | ||
+ | cd nsca-2.7.2 | ||
+ | ./configure | ||
+ | make all | ||
+ | mkdir /usr/local/nagios/nsca | ||
+ | cp src/send_nsca /usr/local/nagios/nsca | ||
+ | cp sample-config/send_nsca.cfg /usr/local/nagios/nsca | ||
+ | cd /usr/local/nagios/ | ||
+ | chown -R nagios:nagios nsca/ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Configuration du serveur ===== | ||
+ | |||
+ | Les fichiers de configuration se trouvent dans ''/usr/local/nagios/etc/''. Ce sont des fichiers avec l'extension ''.cfg''. | ||
+ | Ci-dessous une description des fichiers de configuration : | ||
+ | |||
+ | |||
+ | === cgi.cfg === | ||
+ | Définition des paramètres des scripts CGI. Vous pouvez utiliser le fichier fourni par défaut par Nagios. | ||
+ | |||
+ | === nagios.cfg === | ||
+ | Fichier de configuration de Nagios. A modifier par vos soins selon votre configuration et l’arborescence choisie. Vous pouvez partir du fichier fourni en standard par Nagios et le modifier selon votre configuration. | ||
+ | |||
+ | === resources.cfg === | ||
+ | Définition des ressources externes. Vous pouvez utiliser le fichier fourni par défaut par Nagios. | ||
+ | |||
+ | === objects/ === | ||
+ | C’est dans ce sous-répertoire que sont centralisé les définitions des machines et services à surveiller part votre serveur Nagios. | ||
+ | |||
+ | === objects/commands.cfg === | ||
+ | C’est là que nous allons définir les commandes utilisées par Nagios pour interroger vos machines. Vous pouvez partir du fichier fourni en standard par Nagios et le modifier selon votre configuration. | ||
+ | |||
+ | === objects/contacts.cfg === | ||
+ | Dans ce fichier, il faut configurer les contacts pouvant être prévenu en cas d’alerte. Vous pouvez partir du fichier fourni en standard par Nagios. | ||
+ | |||
+ | === objects/localhost.cfg === | ||
+ | |||
+ | Ce fichier est là pour que Nagios puisse surveiller le serveur sur lequel il est installé (localhost). Vous pouvez partir du fichier fourni en standard par Nagios. | ||
+ | |||
+ | === objects/templates.cfg === | ||
+ | |||
+ | C’est le fichier ou se trouve la définition des “templates”. Vous pouvez partir du fichier fourni en standard par Nagios. | ||
+ | |||
+ | === objects/timeperiods.cfg === | ||
+ | |||
+ | Ce fichier défini les périodes de temps. Vous pouvez partir du fichier fourni en standard par Nagios. | ||