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/12/23 15:33] 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 45: Ligne 46:
  
 Voir aussi : Voir aussi :
-* https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/objectinheritance.html 
 * https://community.icinga.com/t/help-please-adapting-disk-thresholds-per-host/6253 * https://community.icinga.com/t/help-please-adapting-disk-thresholds-per-host/6253
 * [Add Host to HostGroup? Or add HostGroup to Host?](https://support.nagios.com/forum/viewtopic.php?t=44093) * [Add Host to HostGroup? Or add HostGroup to Host?](https://support.nagios.com/forum/viewtopic.php?t=44093)
Ligne 60: Ligne 60:
 ~~~bash ~~~bash
  
-define service{+define service {
         service_description     Memory         service_description     Memory
         hostgroup_name          WEB_APP1         hostgroup_name          WEB_APP1
Ligne 79: 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 86: Ligne 86:
  
  
-### Supervision de services sans hôte associé+### Supervision de services sans hôte réel associé
  
  
Ligne 101: 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 
  
 +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
 +}
 +~~~
 +
 +
 +''remotes.cfg''
 ~~~c ~~~c
-define host{+define host {
         host_name     generic         host_name     generic
- use                 linux-server+        use                 generic-host
  check_command     check_dummy!0     # Revoit toujours OK  check_command     check_dummy!0     # Revoit toujours OK
         max_check_attempts  1         max_check_attempts  1
Ligne 110: Ligne 124:
 } }
  
-define service{+define service {
         service_description plop         service_description plop
         use generic-service         use generic-service
Ligne 116: Ligne 130:
  check_command check_plop!80  check_command check_plop!80
 } }
- 
-~~~ 
- 
- 
- 
-#### Bonne solution 
- 
-Finalement la solution est 
- 
- 
-~~~c 
-define host{ 
-        host_name target 
- use             generic-host 
-} 
- 
-define service{ 
-        service_description plop 
-        use generic-service 
- host_name target 
- check_command check_plop!80 
-} 
- 
- 
 ~~~ ~~~
  
Ligne 187: 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 202: Ligne 192:
  
 ~~~c ~~~c
-define service{+define service {
         service_description     CPU Stats         service_description     CPU Stats
         servicegroups   sysres         servicegroups   sysres
Ligne 213: 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.1766500420.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki