View Full Version : Utiliser et configurer Centreon
raptor45
16th February 2009, 13:07
Bonjour,
Depuis peu, mon tuteur m'a demadné de mettre nagios et centreon en place. Je me suis donc documenté sur le sujet, puis j'ai installé les 2 outils non sans mal, mais maintenant c'est OK, je n'ai plus d'erreur.
En revanche, j'ai un autre souci: je n'arrive pas à utiliser correctement centreon pour bien monitorer mes serveurs, PC, services etc ... J'ai fais un test avec un serveur, il reste tout le temps sur "down". J'ai bien installé le service snmp, je l'ai également configurer. Sur mon nagios, j'ai fais la commande snmpwalk ... , le serveur windows me répond bien donc snmp est bien configuré. Mais je n'arrive pas à configurer Centreon.
Pouvez-vous m'aider svp ?
Merci d'avance.
raptor45.
AkHeNaToN
16th February 2009, 13:25
Mais je n'arrive pas à configurer Centreon.
Qu'entends tu par cela ?
Quel point de contrôle essais tu de mettre en place (nom des plugin utilisés) ?
raptor45
16th February 2009, 13:53
Salut,
Merci pour ta réponse.
Ce que j'entends par là, c'est comment bien entrer les hôtes et comment bien configurer les services à monitorer (par exemple juste un ping pour le moment afin de savoir si mon serveur de fichiers répond bien).
J'ai bien entré "srv-fichiers" dans hote avec la bonne adresse IP, j'ai essayé de configurer le service et de l'attacher à l'hote mais ça ne fonctionne pas.
J'ai exporté la conf vers nagios et tout reste à down.
Je sais pas comment bien m'y prendre.
merci.
raptor45.
AkHeNaToN
16th February 2009, 14:30
1. Configurer un hôte avec son nom, son IP et une commande de cpntrôle telle que "check_host_alive".
2. Attacher un service par exemple "check_centreon_ping" à ton hôte
3. exporter la configuration en cochant toutes les cases puis en cliquant sur le bouton export
4. regarder la sortie de la génération des fichier pour voir s'il y a 0 Warning et 0 errors.
5. Si tes hôtes reste down, regarde dans le fichier nagios.log le résultat de la commande check_host_alive
raptor45
16th February 2009, 15:33
J'ai suivi ce que tu m'as dis et dans nagios.log, voici ce que j'obtiens:
[1234790332] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 9.06 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790367] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 0.20 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790422] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790432] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 0.28 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790462] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790494] Caught SIGTERM, shutting down...
[1234790494] Successfully shutdown... (PID=4674)
[1234790494] ndomod: Shutdown complete.
[1234790494] Event broker module '/usr/local/nagios/bin/ndomod.o' deinitialized successfully.
[1234790496] Nagios 3.0.6 starting... (PID=1761)
[1234790496] Local time is Mon Feb 16 14:21:36 CET 2009
[1234790496] LOG VERSION: 2.0
[1234790496] ndomod: NDOMOD 1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad (nagios@nagios.org)
[1234790496] ndomod: Successfully connected to data sink. 0 queued items to flush.
[1234790496] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1234790496] Warning: Host 'test_XP' has no services associated with it!
[1234790496] Finished daemonizing... (New PID=1772)
[1234790496] INITIAL HOST STATE: Centreon-Server;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.28 ms
[1234790496] INITIAL HOST STATE: srv-fichiers;DOWN;HARD;1;Connection refused
[1234790496] INITIAL HOST STATE: test_XP;UNREACHABLE;HARD;1;Connection refused
[1234790496] INITIAL SERVICE STATE: Centreon-Server;/;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: Centreon-Server;load;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: Centreon-Server;memory;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: Centreon-Server;ping;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: srv-fichiers;E:;CRITICAL;HARD;1;(null)
[1234790496] INITIAL SERVICE STATE: srv-fichiers;Swap;CRITICAL;HARD;1;(null)
[1234790496] INITIAL SERVICE STATE: srv-fichiers;Test Ping;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: srv-fichiers;memory;CRITICAL;HARD;3;(null)
[1234790496] INITIAL SERVICE STATE: srv-fichiers;ping;CRITICAL;HARD;3;(null)
[1234790497] INITIAL SERVICE STATE: srv-fichiers;test cpu nt;CRITICAL;HARD;5;Connection refused
[1234790516] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790531] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 0.21 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790551] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result test_XP UP 'PING OK - Packet loss = 0%, RTA = 0.70 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790551] HOST ALERT: test_XP;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.70 ms
[1234790556] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790601] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790622] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result srv-fichiers DOWN 'Connection refused'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[1234790636] Warning: Attempting to execute the command "/usr/local/nagios/libexec/submit_host_check_result Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 0.23 ms'" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
Merci beaucoup pour ton aide et merci d'avance pour la suite.
AkHeNaToN
16th February 2009, 16:32
De ce que je vois les scripts marchent très bien puisque tu as en sorti "Centreon-Server UP 'PING OK - Packet loss = 0%, RTA = 9.06 ms" ou "Connection refused", le problème vien de /submit_host_check_result qui renvoi 127.
Le script "submit_host_check_result " est-il bien présent dans le répertoire libxec avec les droits 755 pour l'utilisateur nagios ?
raptor45
16th February 2009, 16:52
Salut,
Alors, j'ai vérifié:
le script "submit_host_check_result " est bien présent dans le repertoire. Concernant les droits, la commande ls -al me retourne cette information en face de "submit_host_check_result ":
-rwxr-xr-x 1 root root
Vu que je suis débutant sous linux, peux-tu me dire si c'est bien les droit 755 ? Et de ce que je vois l'utilisateur c'est root et pas nagios ?
AkHeNaToN
16th February 2009, 16:57
non les droits sont pourtant bon (identique aux miens).
poste les définitions d'un hôte et d'un service (associé à l'hôte) qui posent problèmes qui sont contenues dans hosts.cfg et services.cfg
raptor45
16th February 2009, 17:19
Voici ce que donne hosts.cfg:
################################################## #################
# #
# GENERATED BY CENTREON #
# #
# Developped by : #
# - Julien Mathis #
# - Romain Le Merlus #
# #
# www.centreon.com #
# For information : contact@centreon.com #
################################################## #################
# #
# Last modification February 16, 2009, 3:10 pm #
# By Jean-Marie_Monclaire #
# #
################################################## #################
# 'generic-host' host definition 1
define host{
name generic-host
alias generic-host
check_command check_host_alive
max_check_attempts 5
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
contact_groups Supervisors
notification_interval 0
notification_period 24x7
notification_options d,r
notifications_enabled 0
register 0
}
# 'Servers-Win2K' host definition 6
define host{
name Servers-Win2K
use generic-host
alias Windows 2000 Servers
register 0
}
# 'Servers-Win2K3' host definition 7
define host{
name Servers-Win2K3
use Servers-Win2K
alias Windows 2003 Servers
_SNMPVERSION 3
check_period 24x7
contacts Jean-Marie_Monclaire
notification_interval 60
notification_period 24x7
notification_options d,u
notifications_enabled 1
register 0
}
# 'Centreon-Server' host definition 13
define host{
host_name Centreon-Server
use generic-host
alias Monitoring Server
address 127.0.0.1
hostgroups Linux_Servers
}
# 'srv-fichiers' host definition 14
define host{
host_name srv-fichiers
use Servers-Win2K3
alias serveur de fichiers
address 130.130.1.7
_SNMPCOMMUNITY public
_SNMPVERSION 3
parents Centreon-Server
hostgroups Windows_Servers
check_command check_host_alive
max_check_attempts 5
check_interval 60
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
contact_groups Supervisors
contacts Jean-Marie_Monclaire
notification_period 24x7
notification_options d,u
notifications_enabled 1
}
# 'test_XP' host definition 15
define host{
host_name test_XP
alias test XP
address 130.130.1.169
_SNMPVERSION 3
parents srv-fichiers
check_command check_host_alive
max_check_attempts 15
active_checks_enabled 1
check_period 24x7
contact_groups Supervisors
contacts Jean-Marie_Monclaire
notification_interval 15
notification_period 24x7
notification_options d,u
}
Et voici services.cfg:
################################################## #################
# #
# GENERATED BY CENTREON #
# #
# Developped by : #
# - Julien Mathis #
# - Romain Le Merlus #
# #
# www.centreon.com #
# For information : contact@centreon.com #
################################################## #################
# #
# Last modification February 16, 2009, 3:10 pm #
# By Jean-Marie_Monclaire #
# #
################################################## #################
# 'generic-service' service definition 1
define service{
name generic-service
service_description generic-service
is_volatile 0
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
notification_interval 0
notification_period 24x7
notification_options w,c,r
notifications_enabled 0
contact_groups Supervisors
register 0
}
# 'Ping-LAN' service definition 2
define service{
name Ping-LAN
service_description ping
use generic-service
check_command check_centreon_ping!3!200,20%!400,50%
register 0
;TEMPLATE-HOST-LINK generic-host
}
# 'SNMP-DISK-/' service definition 4
define service{
name SNMP-DISK-/
service_description /
use generic-service
check_command check_centreon_remote_storage!/!80!90!$USER2$!1
register 0
;TEMPLATE-HOST-LINK Servers-Linux
}
# 'SNMP-DISK-E:' service definition 10
define service{
name SNMP-DISK-E:
service_description E:
use generic-service
check_command check_centreon_remote_storage!E!80!90!$USER2$!1
register 0
;TEMPLATE-HOST-LINK Servers-Win2K3
}
# 'SNMP-Linux-Load-Average' service definition 11
define service{
name SNMP-Linux-Load-Average
service_description load
use generic-service
check_command check_centreon_load_average!1!$USER2$!4,3,2!6,5,4
register 0
;TEMPLATE-HOST-LINK Servers-Linux
}
# 'SNMP-Linux-Memory' service definition 12
define service{
name SNMP-Linux-Memory
service_description memory
use generic-service
check_command check_centreon_memory
register 0
;TEMPLATE-HOST-LINK Servers-Linux
}
# 'SNMP-Linux-Swap' service definition 13
define service{
name SNMP-Linux-Swap
service_description memory
use generic-service
check_command check_centreon_remote_storage!"Swap Space"!80!90!$USER2$!1
register 0
;TEMPLATE-HOST-LINK Servers-Linux
}
# 'SNMP-Win2K-memory' service definition 14
define service{
name SNMP-Win2K-memory
service_description memory
use generic-service
check_command check_centreon_remote_storage!"Virtual Memory"!80!90!$USER2$!1
register 0
;TEMPLATE-HOST-LINK Servers-Win2K
}
# 'SNMP-Win2K3-Swap' service definition 16
define service{
name SNMP-Win2K3-Swap
service_description Swap
use generic-service
check_command check_centreon_remote_storage!"Virtual Memory"!80!90!$USER2$!1
register 0
;TEMPLATE-HOST-LINK Servers-Win2K3
}
# 'SNMP-Windows-CPU' service definition 17
define service{
name SNMP-Windows-CPU
service_description cpu
use generic-service
check_command check_centreon_cpu!$USER2$!80!90
register 0
;TEMPLATE-HOST-LINK Servers-Win2K
;TEMPLATE-HOST-LINK Servers-Win2K3
}
# 'memory' service definition 22
define service{
hostgroup_name Windows_Servers
service_description memory
use SNMP-Win2K3-Memory
check_command check_nt_memuse
max_check_attempts 1
normal_check_interval 15
retry_check_interval 1
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
notification_interval 1
notification_period 24x7
notification_options w,u
contact_groups Supervisors
contacts Jean-Marie_Monclaire
}
# 'ping' service definition 23
define service{
host_name Centreon-Server
service_description ping
use Ping-LAN
}
# 'ping' service definition 24
define service{
hostgroup_name Windows_Servers
service_description ping
use Ping-LAN
check_command check_host_alive
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
notification_interval 1
notification_period 24x7
notification_options w,u
contact_groups Supervisors
contacts Jean-Marie_Monclaire
}
# 'Swap' service definition 25
define service{
host_name srv-fichiers
service_description Swap
use SNMP-Win2K3-Swap
}
# 'test cpu nt' service definition 26
define service{
host_name srv-fichiers
service_description test cpu nt
use SNMP-Windows-CPU
check_command check_nt_cpu
max_check_attempts 5
check_period 24x7
notification_interval 60
notification_period 24x7
notification_options w,u,c
notifications_enabled 1
contact_groups Supervisors
contacts Jean-Marie_Monclaire
}
# 'Test Ping' service definition 27
define service{
hostgroup_name Windows_Servers
service_description Test Ping
use Ping-LAN
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
active_checks_enabled 1
passive_checks_enabled 0
check_period 24x7
notification_interval 0
notification_period 24x7
notification_options w
notifications_enabled 0
contact_groups Supervisors
contacts Jean-Marie_Monclaire
}
Dans services.cfg, j'ai voulu faire des tests avec "test_cpu_nt" mais ça ne fonctionne pas, ping lan c pareil.
Dans Centreon, j'ai 3 Hôtes : le serveur de supervision, son état est à "up" donc ok mais il y a 4 services qui sont en "critical":
- le service "load"
- le service " ping"
- le service " / "
- le service " memory "
Dans status output, c'est marqué "(null)"
Ensuite, j'ai mon hote "srv-fichiers" avec les services suivants en "critical":
- test ping
- test cpu nt
- swap
- memory
- E:
Dans status output c'est "(null)" aussi sauf pour test cpu nt et memory c'est "connection refused".
Que faut-il que je fasse stp ?
Merci encore.
AkHeNaToN
16th February 2009, 17:33
pour connexion refuse c'est que la connexion snmp n'est pas faite.
Le plugin doit surement utiliser la variable $USER2$ comme communauté alors que tu as renseigné la communauté dans _SNMPVERSION 3.
pour ce qui est du plug in Ping-LAN, lance le dans un terminal la commande
sudo -u nagios ./check_centreon_ping -H 192.168.1.71 -n 3 -w 200,20% -c 500,60%
pour ce qui est du retour (null) recherche sur le forum.
raptor45
16th February 2009, 17:44
Pourtant la connexion snmp fonctionne car lorsque je fais la commande snmpwalk ... il me répond bien.
J'ai pas compris ce que tu veux dire par ça : "Le plugin doit surement utiliser la variable $USER2$ comme communauté alors que tu as renseigné la communauté dans _SNMPVERSION 3."
J'ai testé la commande : sudo -u nagios ./check_centreon_ping -H 192.168.1.71 -n 3 -w 200,20% -c 500,60%
Par contre je comprends pas pk tu me dis de mettre l'IP 192.168.1.71 ?