[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nagios-users
Subject:    [Nagios-users]  Nagios Freeze after Eventhandler execution
From:       Harald =?ISO-8859-1?Q?B=F6hmecke?= <harald.boehmecke () bertelsmann ! de>
Date:       2010-07-21 13:07:42
Message-ID: 1279717662.2758.42.camel () BDI12718
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

Still experiencing the same issue. Does anybody know why Nagios Freezes after \
executing the eventhandler?

Thanks,

Harald



> Hi All,
> 
> Need help with an Eventhandler!
> 
> After Nagios (successfully) executes the eventhandler, no further
> checks are done on any host. Nagios is like in a stopped or stalled
> state. 
> 
> Here is my config. I actually took it from the manual:
> 
> define service {
> host_name                       blah
> service_description             NSCA
> use                             local_1m
> check_command                   check_tcp!5667
> event_handler                   handler_restart_nsca
> event_handler_enabled           1
> register                        1
> 
> }
> define command {
> command_name                             handler_restart_nsca
> 
> command_line                             \
> /usr/share/nagios3/plugins/eventhandlers/restart-nsca  $SERVICESTATE$ \
> $SERVICESTATETYPE$ $SERVICEATTEMPT$ 
> }
> 
> 
> /usr/share/nagios3/plugins/eventhandlers/restart-nsca
> 
> #!/bin/sh
> #
> # Event handler script for restarting the web server on the local
> machine
> #
> # Note: This script will only restart the web server if the service is
> #       retried 3 times (in a "soft" state) or if the web service
> somehow
> #       manages to fall into a "hard" error state.
> #
> 
> 
> # What state is the NSCA service in?
> case "$1" in
> OK)
> # The service just came back up, so don't do anything...
> ;;
> WARNING)
> # We don't really care about warning states, since the service is
> probably still running...
> ;;
> UNKNOWN)
> # We don't know what might be causing an unknown error, so don't do
> anything...
> ;;
> CRITICAL)
> # Aha!  The HTTP service appears to have a problem - perhaps we should
> restart the server...
> 
> # Is this a "soft" or a "hard" state?
> case "$2" in
> 
> # We're in a "soft" state, meaning that Nagios is in the middle of
> retrying the
> # check before it turns into a "hard" state and contacts get
> notified...
> SOFT)
> 
> # What check attempt are we on?  We don't want to restart the web
> server on the first
> # check, because it may just be a fluke!
> case "$3" in
> 
> # Wait until the check has been tried 3 times before restarting the
> web server.
> # If the check fails on the 4th time (after we restart the web
> server), the state
> # type will turn to "hard" and contacts will be notified of the
> problem.
> # Hopefully this will restart the web server successfully, so the 4th
> check will
> # result in a "soft" recovery.  If that happens no one gets notified
> because we
> # fixed the problem!
> 3)
> echo -n "Restarting NSCA service (3rd soft critical state)..."
> # Call the init script to restart the NSCA server
> /etc/init.d/nsca restart
> ;;
> esac
> ;;
> 
> # The HTTP service somehow managed to turn into a hard error without
> getting fixed.
> # It should have been restarted by the code above, but for some reason
> it didn't.
> # Let's give it one last try, shall we?  
> # Note: Contacts have already been notified of a problem with the
> service at this
> # point (unless you disabled notifications for this service)
> HARD)
> echo -n "Restarting HTTP service..."
> # Call the init script to restart the NSCA server
> /etc/init.d/nsca restart
> ;;
> esac
> ;;
> esac
> exit 0
> 


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY TEXT="#000099" BGCOLOR="#ffffff">
<PRE>
Hi,

Still experiencing the same issue. Does anybody know why Nagios Freezes after \
executing the eventhandler?

Thanks,

Harald


</PRE>
<BLOCKQUOTE TYPE=CITE>
    Hi All,<BR>
    <BR>
    Need help with an Eventhandler!<BR>
    <BR>
    After Nagios (successfully) executes the eventhandler, no further checks are done \
on any host. Nagios is like in a stopped or stalled state. <BR>  <BR>
    Here is my config. I actually took it from the manual:<BR>
    <BR>
    define service {<BR>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
host_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
    define command {<BR>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
command_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
handler_restart_nsca<BR>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
command_line&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
/usr/share/nagios3/plugins/eventhandlers/restart-nsca&nbsp; $SERVICESTATE$ \
$SERVICESTATETYPE$ $SERVICEATTEMPT$<BR>  <BR>
    }<BR>
    <BR>
    <BR>
    /usr/share/nagios3/plugins/eventhandlers/restart-nsca<BR>
    <BR>
    #!/bin/sh<BR>
    #<BR>
    # Event handler script for restarting the web server on the local machine<BR>
    #<BR>
    # Note: This script will only restart the web server if the service is<BR>
    #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retried 3 times (in a &quot;soft&quot; \
state) or if the web service somehow<BR>  #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
manages to fall into a &quot;hard&quot; error state.<BR>  #<BR>
    <BR>
    <BR>
    # What state is the NSCA service in?<BR>
    case &quot;$1&quot; in<BR>
    OK)<BR>
    # The service just came back up, so don't do anything...<BR>
    ;;<BR>
    WARNING)<BR>
    # We don't really care about warning states, since the service is probably still \
running...<BR>  ;;<BR>
    UNKNOWN)<BR>
    # We don't know what might be causing an unknown error, so don't do \
anything...<BR>  ;;<BR>
    CRITICAL)<BR>
    # Aha!&nbsp; The HTTP service appears to have a problem - perhaps we should \
restart the server...<BR>  <BR>
    # Is this a &quot;soft&quot; or a &quot;hard&quot; state?<BR>
    case &quot;$2&quot; in<BR>
    <BR>
    # We're in a &quot;soft&quot; state, meaning that Nagios is in the middle of \
retrying the<BR>  # check before it turns into a &quot;hard&quot; state and contacts \
get notified...<BR>  SOFT)<BR>
    <BR>
    # What check attempt are we on?&nbsp; We don't want to restart the web server on \
the first<BR>  # check, because it may just be a fluke!<BR>
    case &quot;$3&quot; in<BR>
    <BR>
    # Wait until the check has been tried 3 times before restarting the web \
server.<BR>  # If the check fails on the 4th time (after we restart the web server), \
the state<BR>  # type will turn to &quot;hard&quot; and contacts will be notified of \
the problem.<BR>  # Hopefully this will restart the web server successfully, so the \
4th check will<BR>  # result in a &quot;soft&quot; recovery.&nbsp; If that happens no \
one gets notified because we<BR>  # fixed the problem!<BR>
    3)<BR>
    echo -n &quot;Restarting NSCA service (3rd soft critical state)...&quot;<BR>
    # Call the init script to restart the NSCA server<BR>
    /etc/init.d/nsca restart<BR>
    ;;<BR>
    esac<BR>
    ;;<BR>
    <BR>
    # The HTTP service somehow managed to turn into a hard error without getting \
fixed.<BR>  # It should have been restarted by the code above, but for some reason it \
didn't.<BR>  # Let's give it one last try, shall we?&nbsp; <BR>
    # Note: Contacts have already been notified of a problem with the service at \
this<BR>  # point (unless you disabled notifications for this service)<BR>
    HARD)<BR>
    echo -n &quot;Restarting HTTP service...&quot;<BR>
    # Call the init script to restart the NSCA server<BR>
    /etc/init.d/nsca restart<BR>
    ;;<BR>
    esac<BR>
    ;;<BR>
    esac<BR>
    exit 0<BR>
    <BR>
</BLOCKQUOTE>
</BODY>
</HTML>



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

_______________________________________________
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic