PDA

View Full Version : Plugins


jask
12-18-2007, 01:13 PM
Bonjour,
Désolé pour l'éventuel hors sujet.
Je me retrouve confronté à un problème face à Nagios, celui-ci est bien installé, je parviens à superviser les machines linux de mon parc sans gros problème. Cependant pour une machine windows ce n'est pas la même réussite :

1. Installation de NSClient++ sur la machine win
2. Vérification de la présence des plugins sur la machine Ubuntu (serveur de supervision)=>OK
3. Test des plugins en mode console (./check_nt -H xxx.xxx.xxx.xxx -v COUNTER –l "\\Processor(_total)\\% Processor Time")=>OK
4. Interface Nagios=>Pour chacun des check l'erreur=>Connection refused
could not fetch information from server

Si jamais je suis pas au bon endroit je remercie les modérateurs de bien vouloir déplacer mon post.

Un grand merci pour votre aide.
Jask

sdouce
12-18-2007, 05:22 PM
Salut ,

il est clair que ca ne communique pas avec ton agent.
Verifie le port et le mot de passe que tu aurais eventuellement dans le NSClient.ini .

Sinon envoie ta conf ici , ca aidera un peu .

Pour ma part j'utilise nsclient pour les windows et j ai beuacoup de fausse alertes du type error code of 139 was out of bound....

sdouce
12-18-2007, 05:23 PM
euh regarde si le service est demarré ca peut aider aussi..

nsclient++ /INSTALL
nsclient++ /START

jask
12-19-2007, 10:23 AM
Bonjour,
Merci pour vos réponses
Le service est bien démarré sûr et certain ;)
Je n'utilise pas de mot de passe dans le .ini, d'ailleurs si les commandes sont exécutées depuis la console ubuntu et que cela fonctionne je peux considérer que mon client réagit correctement ? Non ?

voici tout de même le .ini (mais j'ai peur que le problème se situe en amont)
Merci de votre aide
Jask

[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
; You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; * *
; * N O T I C E ! ! ! - Y O U H A V E T O E D I T T H I S *
; * *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
;
; CheckWMI IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;CheckWMI.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll

[Settings]
;# OBFUSCATED PASSWORD
; This is the same as the password option but here you can store the password in an obfuscated manner.
; *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the
; password. Its just a bit harder to do it at first glance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;# PASSWORD
; This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly.
;password=secret-password
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.
; If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).
; The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that subnet access
allowed_hosts=192.168.0.250 ;127.0.0.1/32
;
;# USE THIS FILE
; Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1
; the registry will be used instead.
use_file=1

[log]
;# LOG DEBUG
; Set to 1 if you want debug message printed in the log file (debug messages are always printed to stdout when run with -test)
debug=1
;
;# LOG FILE
; The file to print log statements to
file=NSC.log
;
;# LOG DATE MASK
; The format to for the date/time part of the log entry written to file.
date_mask=%Y-%m-%d %H:%M:%S


[NSClient]
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.
; If you leave this blank the global version will be used instead.
;allowed_hosts=
;
;# NSCLIENT PORT NUMBER
; This is the port the NSClientListener.dll will listen to.
;port=12489
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to all avalible IP adresses.
;bind_to_address=


[Check System]
;# CPU BUFFER SIZE
; Can be anything ranging from 1s (for 1 second) to 10w for 10 weeks. Notice that a larger buffer will waste memory
; so don't use a larger buffer then you need (ie. the longest check you do +1).
;CPUBufferSize=1h
;
;# CHECK RESOLUTION
; The resolution to check values (currently only CPU).
; The value is entered in 1/10:th of a second and the default is 10 (which means ones every second)
;CheckResolution=10

[NRPE]
;# NRPE PORT NUMBER
; This is the port the NRPEListener.dll will listen to.
;port=5666
;
;# COMMAND TIMEOUT
; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.
;command_timeout=60
;
;# COMMAND ARGUMENT PROCESSING
; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
;allow_arguments=0
;
;# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
;allow_nasty_meta_chars=0
;
;# USE SSL SOCKET
; This option controls if SSL should be used on the socket.
;use_ssl=1
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to all avalible IP adresses.
; bind_to_address=
;
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon.
; If you leave this blank the global version will be used instead.
;allowed_hosts=
;
;# SCRIPT DIRECTORY
; All files in this directory will become check commands.
; *WARNING* This is undoubtedly dangerous so use with care!
;script_dir=scripts\


[NRPE Handlers]
;# COMMAND DEFINITIONS
;# Command definitions that this daemon will run.
;# Can be either NRPE syntax:
;command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
;# Or simplified syntax:
;test=c:\test.bat foo $ARG1$ bar
check_disk1=/usr/local/nagios/libexec/check_disk -w 5 -c 10
;# Or even loopback (inject) syntax (to run internal commands)
;# This is a way to run "NSClient" commands and other internal module commands such as check eventlog etc.
check_cpu=inject checkCPU warn=80 crit=90 5 10 15
;check_eventlog=inject CheckEventLog Application warn.require.eventType=error warn.require.eventType=warning critical.require.eventType=error critical.exclude.eventType=info truncate=1024 descriptions
check_disk_c=inject CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M File:WIN=c:\ATI\*.*
;# But be careful:
; dont_check=inject dont_check This will "loop forever" so be careful with the inject command...
;# Check some escapings...
; check_escape=inject CheckFileSize ShowAll MaxWarn=1024M MaxCrit=4096M "File: foo \" WIN=c:\\WINDOWS\\*.*"
;# Some real world samples
nrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15
nrpe_ok=scripts\ok.bat

boyerf
12-19-2007, 02:22 PM
Si ça fonctionne en ligne de commande, le probleme vient plutot de la commande utilisée dans la config de Nagios.
Poste nous l'implémentation de cette commande...

jask
12-19-2007, 02:54 PM
Voici ce qui, à mon avis, peut poser problème :





#SERVICE DEFINITIONS
#dans windows.cfg

define host{
use windows-server
host_name TEST
alias TEST #serverTest
address 192.168.0.34
}

#Affiche la version du NSClient
define service {
use generic-service
host_name TEST
service_description VERSION
check_command check_nt!CLIENTVERSION
}

# Temps écoulé depuis le dernier reboot (uptime)
define service {
use generic-service
host_name TEST
service_description UPTIME
check_command check_nt!UPTIME
}

# Charge CPU
# WARNING si charge > 80% pendant plus de 5 minutes
# CRITICAL si charge > 90% pendant plus de 5 minutes
define service {
use generic-service
host_name TEST
service_description CPU
check_command check_nt!CPULOAD!-l 5,80,90
}
# Etat de la mémoire disque libre (sur disque c:)
# WARNING si mémoire > 80%
# CRITICAL si mémoire > 90%
define service {
use generic-service
host_name TEST
service_description DISK
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
etc.

Donc les fonctionnalités testées sont :
CPU
DISK
EXPLORER
MEM
UPTIME
VERSION...

Voici le contenu du fichier commands.cfg


# SAMPLE HOST CHECK COMMANDS

# '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_ping' command definition
define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
-p 5
}

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

etc.


Désolé pour la longueur du texte...
J'espère avoir fourni des indications.
Encore merci pour votre aide.
Jask

boyerf
12-19-2007, 03:26 PM
Tu n'as pas mis la definition de ton service ( cpt de temps processeur) dans ta réponse...

Mais si je m'en refere à ta commande :
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}


Dans ton service, tu dois lui passer 2 parametres : $ARG1$ et $ARG2$
Et si je m'en refere à ta ligne de cmd qui fonctionne :
(./check_nt -H xxx.xxx.xxx.xxx -v COUNTER –l "\\Processor(_total)\\% Processor Time")
Ca doit donner en parametre un truc du style :
!COUNTER! -l "\\Processor(_total)\\% Processor Time"
ou alors
!COUNTER!" -l \\Processor(_total)\\% Processor Time"
Fais quelques essais...

Attention aussi à ce que NAGIOS ne filtre pas tes parametres en enlevant le caractere (")

Dis moi si c'est ok.

jask
12-21-2007, 12:45 PM
Bonjour,
J'ai enfin trouvé ce qui me posait problème :).
Il s'agissait du paramètre -p 12489.
En l'enlevant j'ai enfin des statuts plausible :)
Est ce qu'il s'agit du protocole de communication utilisé ?
Donc un problème de firewall sur la machine cliente ?
Merci de votre aide
Jask