Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 27/08/2014, à 20:23

jean8888

nagios problème nrpe [Résolu]

Bonjour

Je suis bien avancé dans l'installation d'un serveur Nagios v4.08 sur ubuntu 14.04.

J'ai utilisé cette doc, sauf les tweaks et nagios graph.
Nagios4_Installation_on_Ubuntu_12.04.html

Le service fonctionne bien avec des clients windows par exemple /usr/local/nagios/libexec/check_nt -H IP_CLIENT -v USEDDISKSPACE -l C -w 10 -c -p 12489 lancé sur le serveur retourne l'espace disque du client.

J'ai inclus quelques clients dans les fichiers de configuration, ils s'affichent bien sur l'interface web de nagios.

Pour ce qui est du monitorer des clients linux j'ai une erreur de connexion au port 5666:

Si je lance cette commande sur le serveur : /usr/local/nagios/libexec/check_nrpe -H 10.31.240.100
J'ai cette erreur:
connect to address 10.31.240.100 port 5666: Connection refused


Voici l'installation que j'ai fait coté client

etape1 sur le poste client qui sera monitoré

 apt-get update 

etape2

 apt-get install openssl nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard 

etape3  "Take the backup of original nrpe.cfg file"

 cp -p  /etc/nagios/nrpe.cfg /etc/nagios/nrpe.cfg.orig 

Etape4 "Now edit the /etc/nagios/nrpe.cfg file and in allowed_hosts give the ip address of Nagios Server from which monitoring will be done."

nano /etc/nagios/nrpe.cfg   

server_port=5666
server_addresss=nagios.mondomaine.com
allowed_hosts=10.31.0.0/16 

etape5

/etc/init.d/nagios-nrpe-server restart 

Now the given below steps should be done in Nagios Server
etape6

loguer en root ou sudo su - 

etape7

 nano /usr/local/nagios/etc/objects/unix.cfg 

define host{
        use                     generic-host;
        host_name               test1.mondomaine.com
        alias                   owncloud
        address                 10.31.240.100
        }


define service{
        use                             generic-service         ; Name of service template to use
        host_name                       test1.mondomaine.com
        service_description             Disk Space
        check_command                    check_nrpe!check_disk
        }


J'ai aussi ouvert le port sur le client par cette commande:
iptables -A INPUT -p tcp --dport 5666 -j ACCEPT

Même résultat impossible de se connecter

Dernière modification par jean8888 (Le 28/08/2014, à 19:38)

Hors ligne

#2 Le 27/08/2014, à 20:26

pires57

Re : nagios problème nrpe [Résolu]

si tu donnes pas de message d'erreur, de fichier de log ou autre je risque pas de t'aider...


Utilisateur d'Archlinux, Ubuntu et Kali Linux
Administrateur système et réseau spécialisé Linux.
LinkedIn

Hors ligne

#3 Le 27/08/2014, à 20:38

jplemoine

Re : nagios problème nrpe [Résolu]

J'ai une question pour windows, tu mets IP_CLIENT, pour linux 10.31.240.100.

10.31.240.100 : c'est bien le PC sur lequel est installé le serveur nrpe est installé et pas le serveur nagios ?
Parce que si c'est la même machine physique, quelle est l’intérêt de nrpe ?


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#4 Le 27/08/2014, à 20:50

jean8888

Re : nagios problème nrpe [Résolu]

L'erreur que j'ai au lancement de la commande spécifié dans mon premier post est que la connexion au port 5666 ne fonctionne pas, il n' y a pas de log.

C'est la première étape ensuite je pourrais continuer vers l'interface web:

Si j'ajoute un host linux dans nagios et que j'essai de redémarrer le service ce log est créé et le service web ne fonctionne pas. (apache fonctionne mais le processus nagios ne répond pas).

Caught SIGTERM, shutting down...
[1409163651] Successfully shutdown... (PID=5632)
[1409163651] Event broker module 'NERD' deinitialized successfully.
[1409163651] Nagios 4.0.8 starting... (PID=5725)
[1409163651] Local time is Wed Aug 27 14:20:51 EDT 2014
[1409163651] LOG VERSION: 2.0
[1409163651] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1409163651] qh: core query handler registered
[1409163651] nerd: Channel hostchecks registered successfully
[1409163651] nerd: Channel servicechecks registered successfully
[1409163651] nerd: Channel opathchecks registered successfully
[1409163651] nerd: Fully initialized and ready to rock!
[1409163651] wproc: Successfully registered manager as @wproc with query handler
[1409163651] wproc: Registry request: name=Core Worker 5727;pid=5727
[1409163651] wproc: Registry request: name=Core Worker 5728;pid=5728
[1409163651] wproc: Registry request: name=Core Worker 5729;pid=5729
[1409163651] wproc: Registry request: name=Core Worker 5730;pid=5730
[1409163651] Error: Service check command 'check_nrpe!check_mem' specified in service 'Memory' for host 'test1.mondomaine.com' not defined anywhere!



En réponse de jplemoine

Cette commande lancé sur le serveur nagios fonctionne
/usr/local/nagios/libexec/check_nt -H IP_CLIENT -v USEDDISKSPACE -l C -w 10 -c -p 12489
IP_Client est remplacé par l'ip de la machine client.
Ex:
/usr/local/nagios/libexec/check_nt -H 10.31.240.1 -v USEDDISKSPACE -l C -w 10 -c -p 12489
Le serveur a nagios 4.0.8 et apache d'installé, le client le connecteur nsclient voir http://www.nsclient.org/download/

J'essai de faire la même chose en utilisant nrpe pour monitorer des clients linux mais cela ne fonctionne pas, encore mais je suppose que je ne suis pas loin de la solution.

Dernière modification par jean8888 (Le 27/08/2014, à 20:58)

Hors ligne

#5 Le 27/08/2014, à 21:00

pires57

Re : nagios problème nrpe [Résolu]

ok tu peut me dire ce que tu as dans ton checkcommands.cfg?


Utilisateur d'Archlinux, Ubuntu et Kali Linux
Administrateur système et réseau spécialisé Linux.
LinkedIn

Hors ligne

#6 Le 27/08/2014, à 21:14

jean8888

Re : nagios problème nrpe [Résolu]

Je n'ais pas modifié ce fichier il est resté par défaut.

Dans /usr/local/nagios/etc/objects/commands.cfg (J'espère que je ne me trompe pas de fichier)

J'ai ceci:

###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.0.8
#
#
# NOTES: This config file provides you with some example command definitions
#        that you can reference in host, service, and contact definitions.
#       
#        You don't need to keep commands in a separate file from your other
#        object definitions.  This has been done just to make things easier to
#        understand.
#
###############################################################################


################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require 
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################


# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
	}

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
	}





################################################################################
#
# SAMPLE HOST CHECK COMMANDS
#
################################################################################


# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip 
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)

# 'check-host-alive' command definition
define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }




################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands.  They may or may not work on
# your system, as they must be modified for your plugins.  See the HTML 
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE:  The following 'check_local_...' functions are designed to monitor
#        various metrics on the host that Nagios is running on (i.e. this one).
################################################################################

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }


# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }


# 'check_local_swap' command definition
define command{
	command_name	check_local_swap
	command_line	$USER1$/check_swap -w $ARG1$ -c $ARG2$
	}


# 'check_local_mrtgtraf' command definition
define command{
	command_name	check_local_mrtgtraf
	command_line	$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
	}


################################################################################
# NOTE:  The following 'check_...' commands are used to monitor services on
#        both local and remote hosts.
################################################################################

# 'check_ftp' command definition
define command{
        command_name    check_ftp
        command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_hpjd' command definition
define command{
        command_name    check_hpjd
        command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
        }


# 'check_snmp' command definition
define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }


# 'check_ssh' command definition
define command{
	command_name	check_ssh
	command_line	$USER1$/check_ssh $ARG1$ $HOSTADDRESS$
	}


# 'check_dhcp' command definition
define command{
	command_name	check_dhcp
	command_line	$USER1$/check_dhcp $ARG1$
	}


# 'check_ping' command definition
define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }


# 'check_pop' command definition
define command{
        command_name    check_pop
        command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
        }


# 'check_imap' command definition
define command{
        command_name    check_imap
        command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
        }


# 'check_smtp' command definition
define command{
        command_name    check_smtp
        command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
        }


# 'check_tcp' command definition
define command{
	command_name	check_tcp
	command_line	$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
	}


# 'check_udp' command definition
define command{
	command_name	check_udp
	command_line	$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
	}


# 'check_nt' command definition
define command{
	command_name	check_nt
	command_line	$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
	}



################################################################################
#
# SAMPLE PERFORMANCE DATA COMMANDS
#
# These are sample performance data commands that can be used to send performance
# data output to two text files (one for hosts, another for services).  If you
# plan on simply writing performance data out to a file, consider using the 
# host_perfdata_file and service_perfdata_file options in the main config file.
#
################################################################################


# 'process-host-perfdata' command definition
define command{
	command_name	process-host-perfdata
	command_line	/usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
	}


# 'process-service-perfdata' command definition
define command{
	command_name	process-service-perfdata
	command_line	/usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
	}

Hors ligne

#7 Le 27/08/2014, à 21:33

pires57

Re : nagios problème nrpe [Résolu]

renvois tout tes fichiers de conf, je ne connais pas trop nagios 4


Utilisateur d'Archlinux, Ubuntu et Kali Linux
Administrateur système et réseau spécialisé Linux.
LinkedIn

Hors ligne

#8 Le 27/08/2014, à 22:02

jplemoine

Re : nagios problème nrpe [Résolu]

il y a un problème avec nrpe pas nagios :

/usr/local/nagios/libexec/check_nrpe -H 10.31.240.100

lancé sur la machine serveur nagios devrait renvoyer la version de nrpe.
Le message d'erreur ressemble au cas suivant : il n'y a pas de serveur nrpe ou il n'est pas lancé.
Y a-t-il un serveur nrpe actif sur la machine 10.31.240.100 ?
pour le savoir :

ps aux | grep nrpe

Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#9 Le 27/08/2014, à 22:11

pires57

Re : nagios problème nrpe [Résolu]

le prbleme se trouve dans nagios.cfg

# NRPE
#cfg_file=/usr/local/nagios/etc/nrpe.cfg

avec NRPE en commentaire tu ne vas pas allez loin


Utilisateur d'Archlinux, Ubuntu et Kali Linux
Administrateur système et réseau spécialisé Linux.
LinkedIn

Hors ligne

#10 Le 27/08/2014, à 22:22

jplemoine

Re : nagios problème nrpe [Résolu]

il y a peut-être plusieurs problèmes. Mais tant que check_nrpe ne fonctionne pas en ligne de commande,
ça ne fonctionnera pas dans nagios. Donc :
Etape 1 : Il faut donc que check_nrpe fonctionne en ligne de commande.
Etape 2 : configurer nagios pour appeler check_nrpe.


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#11 Le 27/08/2014, à 22:44

jean8888

Re : nagios problème nrpe [Résolu]

ps aux | grep nrpe

lancé sur le client au 10.31.240.100 retourne ceci:
1416  0.0  0.0  11684   912 pts/1    S+   16:31   0:00 grep --color=auto nrpe

J'ai rajouté ceci manuellement dans nagios.cfg
# NRPE
#cfg_file=/usr/local/nagios/etc/nrpe.cfg
Il n'y avait pas de fichier de config dans /usr/local/nagios/etc/nrpe.cfg
j'ai copié à partir du dossier d'installation le fichier créé par défaut. Je l'ai édité mais je ne pense pas que c'est la bonne méthode.
Alors j'ai commenté la ligne dans nagios.cfg car cela ne fonctionnais pas.

nrpe à été installé comme  ce qui suit "Download and Compile NRPE" au site https://raymii.org/s/tutorials/Nagios_C … 12.04.html

On dirais que mon client refuse toute connexion au post 5666.

Je lance

netstat -tulpn 

et il n'y a rien qui affiche nrpe, le serveur lui affiche une ligne tcp 0.0.0.0:5666

Dernière modification par jean8888 (Le 28/08/2014, à 15:35)

Hors ligne

#12 Le 27/08/2014, à 23:04

jplemoine

Re : nagios problème nrpe [Résolu]

Sur la machine  10.31.240.100, il faut que tu lances (et installes si c'est pas fait) le serveur-nrpe.

pour l'installer :

sudo apt-get install nagios-nrpe-server

pour le lancer :

sudo service nagios-nrpe-server start

Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#13 Le 27/08/2014, à 23:33

jean8888

Re : nagios problème nrpe [Résolu]

Oui je l'ai fait à l'étape 2 de mon premier post

 apt-get install openssl nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard 

Et le service roule bien , J'ai fait des start/stop assez souvent

Hors ligne

#14 Le 27/08/2014, à 23:44

jplemoine

Re : nagios problème nrpe [Résolu]

jean8888 a écrit :

Et le service roule bien , J'ai fait des start/stop assez souvent

ben non, le grep donne :

jean8888 a écrit :

ps aux | grep nrpe lancé sur le client au 10.31.240.100 retourne ceci:
1416  0.0  0.0  11684   912 pts/1    S+   16:31   0:00 grep --color=auto nrpe

Il devrait y avoir une ligne avec

/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

--> donc, le service n'est pas lancé....


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#15 Le 28/08/2014, à 15:32

jean8888

Re : nagios problème nrpe [Résolu]

Hooo merci pour le hint

Je pensait que mon service roulais..

J'ai trouvé mon erreur j'avais oublié d'ajouter ces 2 lignes dans /etc/nagios/nrpe.cfg sur les clients linux

include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/

Apres un redémarrage du service le retour de la commande

ps aux | grep nrpe

affiche bien  "/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d"

Maintenant pour le service nagios ceci fonctionne:

define service {
        use                             generic-service
        host_name                       HoteLinux
        service_description             SSH
        check_command                   check_ssh
        notifications_enabled           0
        }
define service {
        use                             generic-service
        host_name                       HoteLinux
        service_description             ping
        check_command                   check_ping!100.0,20%!500.0,60%
        notifications_enabled           0
        }

mais je ne réussi pas à faire la même chose avec la mémoire l'espace disque etc.

J'ai essayé ceci et quelques autres, surement un problème de syntaxe.

define service{
        use                             generic-service
        host_name                       HoteLinux
        service_description             Disk Space
        check_command                    check_nrpe!check_disk
        notifications_enabled           0
        }
define service{
        use                             generic-service
        host_name                       HoteLinux
        service_description             Disk Space
        check_command                   check_load -w 15,10,5 -c 30,25,20
        }

Dernière modification par jean8888 (Le 28/08/2014, à 15:33)

Hors ligne

#16 Le 28/08/2014, à 15:42

jplemoine

Re : nagios problème nrpe [Résolu]

J'utilise nconf pour générer les fichiers de configuration. Donc, je ne les maîtrise pas.
je peux juste regarder ceux qui sont générés pour voir...

Le principe est d'appeler coté serveur nagios via check_nrpe un service avec un nom logique.
Puis sur la machine à monitorer via nrpe.cfg il faut associer le nom logique avec une commande....

On peut passer des paramètres depuis le serveur nagios vers la machine à monitorer


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#17 Le 28/08/2014, à 15:59

jplemoine

Re : nagios problème nrpe [Résolu]

Exemple avec check_apcupsd_trad (pour voir les informations de mon onduleur)
(c'est un exemple avec des paramètres)

EDIT : utilisation de la variable HOSTADDRESS

Coté serveur nagios
--------------------------

--- fichier checkcommands.cfg ---
define command {
                command_name                          distant check_apcupsd_trad
                command_line                          $USER1$/check_nrpe  -H $HOSTADDRESS$ -c check_apcupsd_trad -a $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

--- fichier services.cfg ---
define service {
                service_description                   distant check_apcupsd_trad_ld
                check_command                         distant check_apcupsd_trad!load!70!80!fr
                host_name                             Dell-Ubuntu
                check_period                          24x7
                contact_groups                        +admins
                event_handler_enabled                 0
                use                                   generic ss stat
}

Coté machine monitorée
-------------------------------

--- fichier nrpe.cfg ---
command[check_apcupsd_trad]=/usr/lib/nagios/plugins_local/check_apcupsd.new.pl -n $ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$

**********
Les paramètres sont :

Coté serveur nagios             $ARG1$    $ARG2$    $ARG3$  $ARG4$
Coté machine à monitorer    $ARG1$    $ARG2$   $ARG3$   $ARG4$
                                             capteur       warning   critique      langue

Dernière modification par jplemoine (Le 29/08/2014, à 00:40)


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#18 Le 28/08/2014, à 19:34

jean8888

Re : nagios problème nrpe [Résolu]

Ok gros merci

J'ai fait une config basic pour commencer:

Sur le client:

command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

Sur le serveur:
Fichier command.cfg:

define command {
                command_name                          check_nrpe_load
                command_line                          $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_load -a $ARG1$ $ARG2$
}
define command {
                command_name                          check_nrpe_disk
                command_line                          $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk -a $ARG1$ $ARG2$ $ARG3$
}

Fichier sous /usr/local/nagios/etc/objects ou l'on définis les services:


define host{
        use                     linux-host
        host_name               HoteLinux
        alias                         whatever
        address                 10.31.240.100
        }

define service{
        use                             generic-service
        host_name                       HoteLinux
        service_description             load
        check_command                   check_nrpe_load!40!50
		notifications_enabled           0
        }
define service{
        use                             generic-service
        host_name                       HoteLinux
        service_description             disk
        check_command                   check_nrpe_disk!40!50!/dev/sda1
		notifications_enabled           0
        }

Ça marche! Enfin haha
Encore merci pour les longs posts explicatif!

Dernière modification par jean8888 (Le 28/08/2014, à 19:40)

Hors ligne

#19 Le 28/08/2014, à 19:42

jplemoine

Re : nagios problème nrpe [Résolu]

Oui mais tu n'as pas de notification...(envoi de courriel s'il y a un passage en warning ou en critical)
Mais ça sera peut-être une autre étape..
Peux-tu vérifier que $HOSTADDRESS$ est bien le client (la machine à monitorer) et non pas le serveur nagios ?

Utilises-tu la même machine pour le "client" et le "serveur nagios" ? Si oui, ça risque de ne pas fonctionner si les machines sont différentes..


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#20 Le 28/08/2014, à 19:53

jean8888

Re : nagios problème nrpe [Résolu]

Oui les emails automatiques c'est pour une autre étape.

C'est bien 2 hosts différents, en fait à date j'ai fait des tests avec 2 clients Windows et 2 clients Ubuntu.

$HOSTADDRESS$ est bien le client, l'information retournée est bien celle des clients.
Comme preuve j'ai du changer sur le client allowed_hosts=10.31.0.0/16 pour allowed_hosts=nagios.mondomaine.com car sinon les 2 services affichaient l'erreur ssl handshake could not complete en couleur rouge.

Si tu te pose la question pourquoi /16 c'est que je vais surement changer l'adresse ip du serveur nagios car il et dans le range d'ip de test qui on full accès en dehors du firewall.

Je suis en entreprise, je vais bientôt inclure environs 50 serveurs à l'interface.

Dernière modification par jean8888 (Le 12/09/2014, à 17:10)

Hors ligne

#21 Le 28/08/2014, à 20:02

jplemoine

Re : nagios problème nrpe [Résolu]

Si tu as 50 serveurs, il te faut mettre soit nconf soit plutôt centreon.
Ça permet d'avoir une interface web qui va générer les fichiers textes pour nagios.
Merci pour l'info de $HOSTADDRESS$ : je me suis peut-être compliqué la vie.


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne

#22 Le 29/08/2014, à 00:41

jplemoine

Re : nagios problème nrpe [Résolu]

Après des tests, on peut utiliser $HOSTADDRESS$ : ça évite le décalage.
J'ai modifié mon post d'exemple en conséquence..


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

Hors ligne