User Tools

Site Tools


doc:appunti:linux:sa:nagios_passivo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
doc:appunti:linux:sa:nagios_passivo [2010/08/19 06:29] niccolodoc:appunti:linux:sa:nagios_passivo [2014/01/31 16:36] – [Configurazione del server (Nagios)] niccolo
Line 6: Line 6:
  
 Per questo occorre installare **NSCA** (Nagios Service Check Acceptor), che funziona in architettura client-server, sulla porta **TCP 5667**. Per questo occorre installare **NSCA** (Nagios Service Check Acceptor), che funziona in architettura client-server, sulla porta **TCP 5667**.
 +
 +L'installazione è stata fatta con Nagios 3.2.0 su Debian Squeeze e Bacula 5.0.1 con NSCA 2.6 su Suse SLES 10.
  
 ===== Configurazione del server (Nagios) ===== ===== Configurazione del server (Nagios) =====
  
-In Debian troviamo un singolo pacchetto da installare, che contiene il client **''send_nsca''** e il server **''nsca''**. Altre distribuzioni possono fornire pacchetti separati.+In Debian Squeeze troviamo il singolo pacchetto **nsca**, che contiene il client **''send_nsca''** e il server **''nsca''**. In Debian Wheezy invece si hanno i due pacchetti **nsca** e **nsca-client**, openSUSE fornisce **nagios-nsca-client** e **nagios-nsca**.
  
 La comunicazione tra client e server avviene in chiaro e senza password, se si vuole qualcosa di meglio editare il file ''/etc/nsca.cfg'' sul server e ''/etc/send_nsca.cfg'' sul client. Purtroppo l'eventuale password deve essere condivisa tra tutti i client. La comunicazione tra client e server avviene in chiaro e senza password, se si vuole qualcosa di meglio editare il file ''/etc/nsca.cfg'' sul server e ''/etc/send_nsca.cfg'' sul client. Purtroppo l'eventuale password deve essere condivisa tra tutti i client.
Line 20: Line 22:
     name            passive-service     ; The 'name' of this service template,     name            passive-service     ; The 'name' of this service template,
                                         ; referenced in other service definitions                                         ; referenced in other service definitions
-    active_checks_enabled             ; Active service checks are enabled+    active_checks_enabled             ; Active service checks are disabled
     passive_checks_enabled        1     ; Passive service checks are enabled/accepted     passive_checks_enabled        1     ; Passive service checks are enabled/accepted
     parallelize_check                 ; Active service checks should be parallelized     parallelize_check                 ; Active service checks should be parallelized
-                                        ; (disabling this can lead to major performance+                                        ; (disabling this can lead to major performance problems)
     obsess_over_service               ; We should obsess over this service (if necessary)     obsess_over_service               ; We should obsess over this service (if necessary)
     check_freshness                   ; Default is to NOT check service 'freshness'     check_freshness                   ; Default is to NOT check service 'freshness'
-    freshness_threshold           4800 +    freshness_threshold           4800 Threshold for fresh/stale data (seconds)
     notifications_enabled             ; Service notifications are enabled     notifications_enabled             ; Service notifications are enabled
     event_handler_enabled             ; Service event handler is enabled     event_handler_enabled             ; Service event handler is enabled
Line 33: Line 35:
     retain_status_information         ; Retain status information across program restarts     retain_status_information         ; Retain status information across program restarts
     retain_nonstatus_information  1     ; Retain non-status information across program restarts     retain_nonstatus_information  1     ; Retain non-status information across program restarts
 +    notification_interval             ; Only send notifications on status change by default.
 +    is_volatile                   0
 +    check_period                  24x7
     normal_check_interval         5     normal_check_interval         5
     retry_check_interval          1     retry_check_interval          1
     max_check_attempts            4     max_check_attempts            4
 +    notification_period           24x7
 +    notification_options          w,u,c,r
 +    contact_groups                admins
     register                      0     ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE,     register                      0     ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE,
                                         ; JUST A TEMPLATE!                                         ; JUST A TEMPLATE!
Line 52: Line 60:
         name                            bacula-service         name                            bacula-service
         use                             passive-service         use                             passive-service
-        freshness_threshold             100800+        freshness_threshold             93600   ; 26 hours 
 +        max_check_attempts              1
         check_command                   return-critical         check_command                   return-critical
 +        notification_interval           1440
         register                        0         register                        0
 } }
 </file> </file>
 +
 +Due parametri i fondamentali da configurare. Il primo è **freshness_threshold**: aspettiamo fino a 26 ore di ricevere un check passivo, altrimenti si esegue un check attivo che ritorna uno stato CRITICAL. Il secondo parametro importante è **max_check_attempts** da impostarsi ad un valore molto basso, possibilmente 1; in questo modo lo //status type// diviene HARD al primo check fallito. Se si lasciasse il valore predefinito di max_check_attempts pari a 4 si avrebbe che per 26 * 4 = 104 ore il servizio risulta SOFT CRITICAL, e quindi mostrato in verde nel grafico del trend.
  
 Poi si aggiunge un finto host, che serve solo per raggruppare tutti i backup monitorati. Si può creare il file **''/etc/nagios3/conf.d/bacula_backups.cfg''**: Poi si aggiunge un finto host, che serve solo per raggruppare tutti i backup monitorati. Si può creare il file **''/etc/nagios3/conf.d/bacula_backups.cfg''**:
Line 90: Line 102:
 </file> </file>
  
-Quando Nagios è in esecuzione dovrebbe ricevere le notifiche da **''nsca''** sulla pipe **''/var/lib/nagios3/rw/nagios.cmd''** (ma forse per questo bisogna attivare gli **[[http://nagios.sourceforge.net/docs/2_0/extcommands.html|external commands]]**?)Altrimenti i comandi vengono accodati al file **''/var/run/nagios/nsca.dump''** e processati in seguito.+Quando Nagios è in esecuzione riceve le notifiche da **''nsca''** sulla pipe **''/var/lib/nagios3/rw/nagios.cmd''**ma questa esiste solo se sono attivi gli **[[http://nagios.sourceforge.net/docs/2_0/extcommands.html|external commands]]**. Per questo verificare che in **''/etc/nagios3/nagios.cfg''** ci siano almeno queste impostazioni:
  
 +<file>
 +check_external_commands=1
 +command_check_interval=10
 +</file>
 +
 +Se la pipe non esiste i comandi vengono accodati al file **''/var/run/nagios/nsca.dump''** e processati in seguito (Davvero? Non pare proprio! Come dovrebbe funzionare?).
 +
 +===== Problema di versione =====
 +
 +Attenzione alla **versione del client e del server nsca**! Debian Squeeze (nsca 2.7.2) e Debian Wheezy (nsca 2.9.1) non sono compatibili, ma il messaggio di errore del server non è chiaro, con la crittografia attiva l'errore è:
 +
 +<code>
 +Dropping packet with invalid CRC32 - possibly due to client using wrong password or crypto algorithm?
 +</code>
 +
 +più comprensibile se la crittografia è disabilitata:
 +
 +<code>
 +Received invalid packet type/version from client - possibly due to client using wrong password or crypto algorithm?
 +</code>
 +
 +Per fortuna si trova il backport del pacchetto per Debian Squeeze.
 ===== Configurazione del client (Bacula) ===== ===== Configurazione del client (Bacula) =====
  
-Installare il cient che consiste essenzialmente nel programma **''send_nsca''**. Predisporre uno script del tipo (**ATTENZIONE** il separatore per il file da dare in input a send_nsca è il TAB): +Installare il cient che consiste essenzialmente nel programma **''send_nsca''**. In GNU/Linux Suse SLES 10 troviamo il pacchetto **nagios-nsca-client**. 
 + 
 +Predisporre uno script del tipo (**ATTENZIONE** il separatore per il file da dare in input a send_nsca è il TAB): 
  
 <code bash> <code bash>
Line 114: Line 150:
  
 send_nsca -H 172.16.237.211 -c /etc/send_nsca.cfg <<END send_nsca -H 172.16.237.211 -c /etc/send_nsca.cfg <<END
-BACKUPS $1      $status $3+Bacula_backups    $1    $status    $3
 END END
 </code> </code>
Line 135: Line 171:
  
 <code> <code>
-/usr/local/sbin/bacula2nagios job_name 0 "OK Incremental p00v1"+/usr/local/sbin/bacula2nagios FileServer 0 "OK Incremental p00v1"
 </code> </code>
doc/appunti/linux/sa/nagios_passivo.txt · Last modified: 2014/01/31 16:39 by niccolo