Outils pour utilisateurs

Outils du site


tech:notes_supervision_nagios

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:notes_supervision_nagios [2025/04/19 14:34] Jean-Baptistetech:notes_supervision_nagios [2026/01/16 14:51] (Version actuelle) Jean-Baptiste
Ligne 7: Ligne 7:
  
 Voir : Voir :
 +* [[Exemple simple de conf Nagios]]
 * [Stop using Nagios - Andy Sykes](https://www.youtube.com/watch?v=Q9BagdHGopg) * [Stop using Nagios - Andy Sykes](https://www.youtube.com/watch?v=Q9BagdHGopg)
 * https://guihot.fr/assets/doc/documentation_supervision.pdf * https://guihot.fr/assets/doc/documentation_supervision.pdf
Ligne 59: Ligne 60:
 ~~~bash ~~~bash
  
-define service{+define service {
         service_description     Memory         service_description     Memory
         hostgroup_name          WEB_APP1         hostgroup_name          WEB_APP1
Ligne 78: Ligne 79:
 ~~~bash ~~~bash
  
-define command{+define command {
         command_name    check_snmp_mem_cpu         command_name    check_snmp_mem_cpu
         command_line    $USER1$/check_snmp_mem.sh -H $HOSTADDRESS$ -t $ARG1$ -w $ARG2$ -c $ARG3$         command_line    $USER1$/check_snmp_mem.sh -H $HOSTADDRESS$ -t $ARG1$ -w $ARG2$ -c $ARG3$
Ligne 85: Ligne 86:
  
  
-### Supervision de services sans hôte associé+### Supervision de services sans hôte réel associé
  
  
Ligne 100: Ligne 101:
 Dans certains cas il faudrait créer un hôte fantôme pour porter le service  Dans certains cas il faudrait créer un hôte fantôme pour porter le service 
  
-~~~c +Dummy
-define host{ +
-        host_name ghost +
- use             linux-server +
- check_command check_dummy!0     # Revoit toujours OK +
-}+
  
-define service+''commands.cfg'' 
-        service_description plop +~~~bash 
-        use generic-service +# 'check_dummy' command definition 
- host_name ghost +# NOTE: This command always returns an 'OK' result no matter what. 
- check_command check_plop!80+define command 
 +        command_name    check_dummy 
 +        command_line    $USER1$/check_dummy 0
 } }
 ~~~ ~~~
- 
-#### Bonne solution 
- 
-Finalement la solution est 
  
  
 +''remotes.cfg''
 ~~~c ~~~c
-define host{ +define host { 
-        host_name target +        host_name     generic 
- use             generic-host+        use                 generic-host 
 + check_command     check_dummy!0     # Revoit toujours OK 
 +        max_check_attempts 
 +        contact_groups      admins
 } }
  
-define service{+define service {
         service_description plop         service_description plop
         use generic-service         use generic-service
- host_name target+ host_name generic
  check_command check_plop!80  check_command check_plop!80
 } }
- 
- 
 ~~~ ~~~
  
Ligne 181: Ligne 177:
 ''etc/objects/servers.cfg'' ''etc/objects/servers.cfg''
 ~~~c ~~~c
-define service{+define service {
     use generic-service     use generic-service
     hostgroup linux-remotes-servers     hostgroup linux-remotes-servers
Ligne 196: Ligne 192:
  
 ~~~c ~~~c
-define service{+define service {
         service_description     CPU Stats         service_description     CPU Stats
         servicegroups   sysres         servicegroups   sysres
Ligne 207: Ligne 203:
  
  
-### Conf command 
  
-Dummy 
-''commands.cfg'' 
-~~~bash 
-# 'check_dummy' command definition 
-# NOTE: This command always returns an 'OK' result no matter what. 
-define command{ 
-        command_name    check_dummy 
-        command_line    $USER1$/check_dummy 0 
-} 
-~~~ 
- 
-Trouver les commandes non utilisées 
-~~~bash 
-for CMD in $(grep command_name etc/objects/commands.cfg |grep -v "^#" |awk '{ print $2}' |sort  -u) ; do grep -q "$CMD" $(find etc/objects/ -type f -not -name commands.cfg) || echo $CMD; done 
-~~~ 
- 
-Trouver les commandes en double 
-~~~bash 
-diff <(grep -v ^# etc/objects/commands.cfg |awk '/command_name/ { print $NF }' | sort) <(grep -v ^# etc/objects/commands.cfg |awk '/command_name/ { print $NF }' | sort -u) 
-~~~ 
- 
- 
- 
- 
-### Sondes locales 
- 
- 
-Toutes les sondes locales (qui remonte des infos du host sur lequel le script est exécuté) devraient avoir un ''command_name'' commençant par "check_local_" 
- 
-Sauf exception seules les fichiers suivants devraient contenir ce motif 
-~~~ 
-$ rgrep -l check_local_ * 
-objects/commands.cfg 
-objects/localhost.cfg 
-~~~ 
- 
-Exemple  
- 
-''objects/commands.cfg'' 
-~~~c 
-define command { 
-    command_name    check_local_procs 
-    command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ 
-} 
-~~~ 
- 
- 
-Même chose avec les ''local-service'' 
- 
-~~~ 
-$ rgrep -l local-service * 
-objects/templates.cfg 
-objects/localhost.cfg 
-~~~ 
- 
- 
- 
-### templates.cfg 
- 
-* Tous les bloques de code ''register 0'' devraient être dans le fichier templates.cfg 
-* Tous les bloques de code présent dans le fichier templates.cfg devrait avoir ''register 0'' 
- 
-### Vérifier la conf 
- 
-~~~bash 
-/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 
-~~~ 
  
  
tech/notes_supervision_nagios.1745066083.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki