presentation de nagios mohamed bouhamed

38
PRESENTATION DE NAGIOS LA SUPERVISION, NAGIOS ET SON ECOSYSTEM. MOHAMED BOUHAMED For help you may contact me by mail : [email protected] 13/04/2015 1

Upload: bouhamed-mohamed

Post on 19-Jul-2015

118 views

Category:

Engineering


2 download

TRANSCRIPT

PRESENTATION DE NAGIOSLA SUPERVISION, NAGIOS ET SON ECOSYSTEM.

MOHAMED BOUHAMED

For help you may contact me by mail : [email protected] 13/04/2015 1

POUR QUOI LA SUPERVISION ?

13/04/2015 [email protected]

C'EST TRÈS SIMPLE.

13/04/2015 [email protected]

PLUSIEURS CLIENT ! ET PLUSIEURS SERVICE ,,,,

13/04/2015 [email protected]

CE QU'IL EST POSSIBLE DE SUPERVISER :

La charge système, la mémoire, la température

Les processus, les services

La connectivité réseau, le traffic

À peu près tout, grâce aux scripts...

13/04/2015 [email protected]

FONCTIONNEMENT :ARCHITECTURE CLIENT/SERVEUR

13/04/2015 [email protected]

NAGIOS EST COMPOSÉ DE 3 PARTIES :

Un ordonnanceur

Des plugins

Une interface web

13/04/2015 [email protected]

13/04/2015 [email protected]

POUR RÉCUPÉRER LES INFORMATIONS, UTILISATION DE PLUGINS. IL EXISTE DIFFÉRENTES MÉTHODES D'INTERROGATION :

Active check

Protocole SNMP

NRPE

Passive check

NSCA

13/04/2015 [email protected]

QUEL QUE SOIT LEUR TYPE, LES PLUGINS DOIVENT RETOURNER UN CODE ET UNE CHAINE.

13/04/2015 [email protected]

Active check

• C'est le serveur Nagios qui initie la demande d'information.

Passive check

• Le serveur est à l'écoute d'informations envoyées par un script distant.

13/04/2015 [email protected]

SNMP

• Simple Network Management Protocol

• Va lire des informations propres à un matériel, dans la MIB (Management

Information Base) et les transmet via le port UDP 161.

13/04/2015 [email protected]

SNMP

1. Requête SNMP2. Récupération de l'objet désiré dans la MIB3. Réponse SNMP

13/04/2015 [email protected]

• Il existe plusieurs versions de SNMP.

• SNMP v1 et v2 : peu sécurisés.

• Un “mot de passe”, la communauté.

• SNMP v3 : bien plus sécurisé.

• Chiffrement, authentificaton, timestamp.

13/04/2015 [email protected]

NRPE (NAGIOS REMOTE PLUGIN EXECUTOR)

• Un plugin de Nagios va interroger un démon installé sur le serveur distant.

Ce démon va exécuter un script pour obtenier les informations, puis les

envoyer.

• Le script peut être écrit en n'importe quel langage.

13/04/2015 [email protected]

NSCA

• C'est une vérification passive : le serveur Nagios possède un démon NSCA,

qui ne fait qu'écouter l'arrivée d'informations de clients. C'est le client qui

émet ces informations.

13/04/2015 [email protected]

INTERFACE ?

• L'interface de base de Nagios est un peu vieillote.

• Elle est au moins fonctionnelle.

• Possibilité de visualiser le parc par services, par hôtes, vue d'ensemble...

• http://your-domain.tld/nagios3

13/04/2015 [email protected]

13/04/2015 [email protected]

CONFIGURATION

• Basiquement, nous devons définir :

Des hôtes

• une machine physique, virtuelle, un équipement.

Des services

• une ressource ou un service à surveiller sur une machine.

Des commandes

• une association nom de commande - script

13/04/2015 [email protected]

services.cfg

define service

{

use generic-service

host_name host1

service_description PING

is_volatile 0

check_period 24x7

max_check_attempts 3

normal_check_interval 5

retry_check_interval 1

notification_interval 240

notification_period 24x7

notification_options c,r

check_commandcheck_ping

}

hosts.cfg

define host{use generic-host

host_name host1alias myHostaddress 127.0.0.1check_command check-host-alivemax_check_attempts 20notification_interval 60notification_period 24x7notification_options d,u,r}

13/04/2015 [email protected]

Options de notification

envoi d'une notification lors d'un état.

Pour les hôtes :

d = DOWN

u = UNREACHABLE

r = retour en NORMAL

n = none

Pour les services :

w = WARNING

u = UNKNOWN

r = retour en NORMAL

n = none

13/04/2015 [email protected]

À propos des notifications

En plus de l'interface web, Nagios est capable d'envoyer des notifications :

Par mailPar smsPar curl (Ex : Twitter)

13/04/2015 [email protected]

commands.cfg

define command

{command_name command_namecommand_line command_line}

Il y a encore bien des choses à configurer, mais nous avons ici le minimum pour que Nagios fonctionne.

13/04/2015 [email protected]

DÉCUPLER LA PUISSANCE DE NAGIOS

Plusieurs projets ont pour objectif d'étoffer les fonctionnalités de Nagios, de le compléter, de l'améliorer, ou de simplifier son utilisation.

Centreon

Cacti

Shinken

EoN

13/04/2015 [email protected]

EXEMPLE CENTREON :

Utilisation de l'ordonnanceur et des plugins de Nagios.

Interface web plus moderne.

Administration directement via l'interface web.

Exportation des configs vers Nagios.

Graphes

13/04/2015 [email protected]

13/04/2015 [email protected]

INSTALLATION DES MODULE + NAGIOS SUR UBUNTU 14,04

• Apache2

• Mysql

• PhpMyAdmin

• PHP5

• Nagios 3

• Open SSL

• Snmp

13/04/2015 [email protected]

• let us Install Nagios Core 4.0.7 Network Monitoring Tool and Nagios

Plugins 2.0.3 Latest Version in Ubuntu 14.04 Server.

• 1. Software Required

Nagios 4.0.7.tar.gz

Nagios plugins 2.0.3.tar.gz

• 2. You Need to Login With Root to Perform all Command

Step1 :- sudo su

• 3. Installed packages

Step2 :- sudo apt-get install apache2 build-essential daemon libapache2-

mod-php5 libgd2-xpm libgd2-xpm-dev php5-gd unzip wget sendmail

13/04/2015 [email protected]

• 4. Installation Part

Update ubuntu repositories by giving the below command

Step3 :- sudo apt-get update

Step4 :- sudo apt-get upgrade

● 5. Install package

-Step5:- sudo apt-get install apache2 php

-Step6:- sudo apt-get install gcc glibc-common

-Step7:- sudo apt-get install gd gd-devel

13/04/2015 [email protected]

● 6. Create Nagios User, Group and Password

-Step8:- useradd nagios or /usr/sbin/useradd -m nagios -Step9:-

passwd nagios

-Step10:- groupadd nagcmd or /usr/sbin/groupadd nagcmd

-Step11:- usermod -G nagcmd nagios usermod -G nagcmd

apache or /usr/sbin/usermod -a -G nagcmd Nagios

.7. Download Nagios Core 4.0.7 and Nagios Plugin 2.0.3

Step12:- mkdir /root/nagios

Step13 :- cd /root/nagios

13/04/2015 [email protected]

-Step14:- sudo wget http://prdownloads.sourceforge.net/so...

-Step15:- sudo wget https://www.nagios-plugins.org/downlo...

OR DIRECT D/L LINK http://www.nagios.org/download/core

13/04/2015 [email protected]

8. Unzip the download nagios

-Step13:- tar xvf nagios-4.0.7.tar.gz

-Step:ll (two new folders will appear in that directory)

-Step14:- cd nagios-4.0.7.tar.gz

-Step15:- ./configure --with-command-group=nagios--with-command

-group=nagcmd --with-mail=/usr/bin/sendmail

-Step16:- make all

-Step17:- make install

-Step18:- make install-init ---- scripts

-Step19:- make install-config ---- configuration file

-Step20:- make install-commandmode ---- external dir command

-Step21:- make install-webconf ---- apache and nagiso config file install

13/04/2015 [email protected]

1. In this step, we will be creating a password for “nagiosadmin"

2. Keep it remember because this password will be used when you login in the

Nagios Web interface.

Step:- htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

.9. Customizing Nagios Configuration

-Step22 :- vi /usr/local/nagios/etc/objects/contacts.cfg

11. Unzip the download nagios

-Step25:- cd /home/download or cd /root/nagios

-Step26:- tar xvf nagios-2.03.tar.gz

-Step27:- cd nagios-2.0.3.tar.gz

-Step28:- ./configure --with-nagios-user=nagios --with-nagios- -

group=nagios

-Step29:- make all

-Step30:- make install

13/04/2015 [email protected]

• .12. Copy and link Nagios Apache configuration

-Step31:- sudo cp /etc/apache2/conf.d/nagios.conf /etc/apache2/sites-

available/nagios

-Step32:- sudo ln -s /etc/apache2/sites-available/nagios

/etc/apache2/sites-enabled/nagios

. 14. Check Nagios configuration for errors

-Step33:- sudo /usr/local/nagios/bin/nagios -v

/usr/local/nagios/etc/nagios.cfg

.15. Make Nagios and Apache start at boot

-Step34:- sudo ln -s /etc/init.d/nagios /etc/rcS.d/S98nagios

-Step35:- sudo ln -s /etc/init.d/apache2 /etc/rcS.d/S99apache2

-Step36:- chkconfig -add nagios

-Step37:- chkconfig nagios on

13/04/2015 [email protected]

• .16. Start Nagios Core 4.0.7 Service

-step38 :- sudo service nagios start

.17. Start Apache Service

-step39 :- sudo service apache2 start TESTING TIME

Visit Nagios URL in your browser

http://IPADDRESS/nagios or http://domainname.cm/nagios

username:- nagiosadmin and password:- created in step 8

.18. To Add New User & Reset Password

The user's credentials password are stored in

/etc/nagios3/htpasswd.users

13/04/2015 [email protected]

• .19. To change the nagiosadmin password.

-step43:- sudo htpasswd /etc/nagios3/htpasswd.users nagiosadmin

.20. To add a user

-step44:- sudo htpasswd /etc/nagios3/htpasswd.users steve ERROR

Error 1 after login :- error could not read object configuration data

nagios 4 run nagios as daemon.

.Step40:- sudo /usr/local/nagios/bin/nagios -d

/usr/local/nagios/etc/nagios.cfg

Error 1 after login:- It appears as though you do not have permission to

view information for any of the hosts you requested.

.Step41:- sudo nano /usr/local/nagios/etc/cgi.cfg

.Step42:- sudo service nagios restart

13/04/2015 [email protected]

13/04/2015 37

13/04/2015 38