Formoso, Travis wrote: >> OK I will try to give it the check_http check and see if it works when I > > >> bring down the httpd. >> > > Here is what I have now: (I added the event handler to http) > > # http > define service{ > use generic-service > > host_name > www.blueslate.net,prpc,mars.blueslate.net,localhost > service_description HTTP > is_volatile 0 > check_period 24x7 > max_check_attempts 3 > event_handler restart-httpd > normal_check_interval 3 > retry_check_interval 1 > contact_groups bssadmins > notification_interval 60 > notification_period 24x7 > notification_options w,u,c,r > check_command check_http!guest:guest > } > > Here is the output of the log file: > > [1169048695] SERVICE ALERT: localhost;HTTP;CRITICAL;SOFT;1;Connection refused > [1169048695] SERVICE EVENT HANDLER: > localhost;HTTP;CRITICAL;SOFT;1;restart-httpd > [1169048755] SERVICE ALERT: localhost;HTTP;CRITICAL;SOFT;2;Connection refused > [1169048755] SERVICE EVENT HANDLER: > localhost;HTTP;CRITICAL;SOFT;2;restart-httpd > [1169048815] SERVICE ALERT: localhost;HTTP;CRITICAL;HARD;3;Connection refused > [1169048815] SERVICE NOTIFICATION: > tformoso;localhost;HTTP;CRITICAL;notify-by-email;Connection refused > [1169048815] SERVICE EVENT HANDLER: > localhost;HTTP;CRITICAL;HARD;3;restart-httpd > > I shut down the httpd - however the service did not restart auto - so the > handler is not working. Any thing I can try or did wrong? >
Have you tried running the "restart-httpd" command as the Nagios user from the console? Also, on my server Apache (2.2) takes roughly 3-4 seconds to start up, and it looks like Nagios doesn't provide any delay between running the event handler, and the subsequent check if httpd's running. If the command works OK, try adding a "sleep for 5 seconds" command (e.g. "sleep 5" for bash) to your event handler script after Apache has started. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null