Questa è una vecchia versione del documento!
Nagios NRPE Event Handler
Appunti per Event Handler
in questo esempio prendiamo:
1) server nagios che monitora http
2) ubuntu server apache, nrpe server
Impostare quanto segue su ubuntu server http, nrpe ( il server DA monitorare ):
creare un semplice script del tipo:
#!/bin/sh
service apache2 stop
service apache2 start
salvarlo come /etc/nagios/restart-http.sh
impostare il comando:
##On Event- HTTP CRASH - Restart - nrpe event handler
command[restart_httpd]=sh /etc/nagios/restart-http.sh
Dare i permessi all'utente “nagios” in sudoers:
nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
nagios ALL=(ALL) NOPASSWD: /usr/bin/service
Nagios Server:
Impostare il servizio come segue:
define service {
host_name UbuntuFront \\
service_description HTTPD \\
check_command check_http \\
max_check_attempts 4 \\
event_handler restart-httpd!$SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ \\
use generic-service,nagiosgraph \\
notification_interval 0 ; set > 0 if you want to be renotified \\
}
Impostare il comando:
