Hello Users: <br><br>I have a problem with an event handler of mine. The handler starts a java daemon-like program which loops forever waiting for connections and performs JMX queries against our java applications.<br><br>
The problem is that the handler times out when it is run by nagios. This is what I see in the logs: <br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[01-07-2009 18:45:36] SERVICE EVENT HANDLER: bj-mon-01;JMX_Server_Running;(null);(null);(null);start_jmx_server</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[01-07-2009 18:46:07] Warning: Service event handler command
'/usr/local/nagios/libexec/eventhandlers/start_jmx_server CRITICAL SOFT
1' timed out after 30 seconds</span><br><br>The event handler should start my JMXServer both in hard and soft states. I have run the command from the console as the "nagios" user and it works, so the problem has nothing to do with user rights for nagios. <br>
<br>The problem is that the handler hangs when I run "nohup" followed by my command for starting the server (see the red text below).<br><br>My event handler looks like this: <br><br><span style="font-family: courier new,monospace;">###########################</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># PROPERTIES</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">###########################</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">PORT="4444"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ECHO_CMD="/bin/echo"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">JAVA_CMD="/usr/bin/java"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">CLASSPATH="MyClasspath"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">JVM_OPTIONS="MyOptions"</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">###########################</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># What state is the JMXServer in?</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">case "$1" in</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">OK)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">WARNING)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">UNKNOWN)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">CRITICAL) </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> case "$2" in</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> SOFT)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> `$ECHO_CMD "TRYING restart" >> /tmp/test`</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> <span style="color: rgb(255, 0, 0);"> nohup $JAVA_CMD -cp $CLASSPATH $JVM_OPTIONS JMXServer $PORT </dev/null 2>&1 >> $LOG_FILE&</span></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> `$ECHO_CMD "TRYING restart" >> /tmp/test`</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> HARD)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> `$ECHO_CMD "TRYING restart" >> /tmp/test`</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace; color: rgb(255, 0, 0);"> nohup $JAVA_CMD -cp $CLASSPATH $JVM_OPTIONS JMXServer $PORT </dev/null 2>&1 >> $LOG_FILE&</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> `$ECHO_CMD "FINISHED trying" >> /tmp/test`</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> esac</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ;;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">esac</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">exit 0</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">Any help, hint or recommendation is deeply appreciated. <br><br>//Marco<br>