chown shinken:shinken named-pipe.cfg chmod 644 named-pipe.cfg |
define service{
service_description TRAP
check_command check-host-alive
host_name TRAP-modele
is_volatile 1
passive_checks_enabled 1
active_checks_enabled 0
check_freshness 1
freshness_threshold 300
register 0
check_interval 1
retry_interval 1
}
define host{
name TRAP-modele
register 0
}
|
La configuration de check présentée ci-dessus est celle d'un check passif. Le statut d'un check de ce type va être mis à jour manuellement via la réception de traps SNMP. Si aucun statut n'est reçu de manière passive pour ce check au bout de 5mn, Shinken déclenche une vérification manuelle pour éviter d'avoir un statut trop ancien et non représentatif de l'état de l'élément représenté par le check. Ce comportement est configuré via les options "check_freshness" (pour l'activation de ce comportement), "check_command" (pour la commande de vérification lancée par Shinken) et "freshness_threshold" (en secondes, 300 pour 5mn). Par contre, ce comportement peut entraîner des changements de statuts du check si l'intervalle d'envoi des statuts vers le check (traps SNMP dans notre exemple) est supérieur à l'intervalle définit par l'option "freshness_threshold". Il faut donc avoir conscience de ce comportement et régler la valeur de l'option "freshness_threshold" ou bien désactiver cette fonctionnalité pour ce check ("check_freshness 0"). |
#!/bin/bash # Arguments: # $1 = host_name (Short name of host that the service is associated with) # $2 = svc_description (Description of the service) # $3 = return_code (An integer that determines the state of the service check, 0=OK, 1=WARNING, 2=CRITICAL,3=UNKNOWN). # $4 = plugin_output (A text string that should be used as the plugin output for the service check) echocmd="/bin/echo" CommandFile="/var/lib/shinken/shinken.cmd" # get the current date/time in seconds since UNIX epoch datetime=`date +%s` # create the command line to add to the command file cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4" # append the command to the end of the command file $echocmd "$cmdline" >> $CommandFile |
chown shinken:shinken /var/lib/shinken-user/libexec/submit_check_result_to_receiver chmod +x /var/lib/shinken-user/libexec/submit_check_result_to_receiver |
/var/lib/shinken-user/libexec/submit_check_result test-trap TRAP 2 "test envoi trap - CRITIQUE" |
Les arguments sont:
|