Forum Discussion

Matt_85761's avatar
Matt_85761
Icon for Nimbostratus rankNimbostratus
May 22, 2012

PIDFILE cleanup broken in sample monitor?

I came across the above error after deploying an EAV monitor in LTM 10.2.3

 

 

 

After debugging and stepping through the script we were able to confirm that it never reaches the PIDFILE cleanup line on successful execution:

 

 

 

mark node UP if expected response was received

 

if [ $? -eq 0 ]

 

then

 

echo "UP"

 

fi

 

 

 

rm -f $PIDFILE

 

 

 

This appears to be 'normal' as result of any STDOUT generated by the script causing bigd to terminate the EAV process, as described in http://support.f5.com/kb/en-us/solu...l7444.html

 

 

 

In order to render the logged warning useful and only triggered under the condition where the script failed to exit, shouldn't we be removing the pidfile AFTER the test and BEFORE any output?

 

 

 

i.e.

 

 

 

 

mark node UP if expected response was received

 

if [ $? -eq 0 ]

 

then

 

rm -f $PIDFILE

 

echo "UP"

 

fi

 

 

rm -f $PIDFILE

 

 

 

or even cleanup before evaluation of the test error code (requires setting a var for the return code):

 

 

 

send request & check for expected response

 

curl -fNs http://${NODE}:${PORT}${URI} -d "${DATA}" | grep -i "${RECV}" 2>&1 > /dev/null

 

RC=$?

 

 

 

remove the pidfile, since the monitor executed

 

rm -f $PIDFILE

 

 

 

mark node UP if expected response was received

 

if [ $RC -eq 0 ]

 

then

 

echo "UP"

 

fi

 

 

 

exit

 

 

 

 

Is anyone else getting the same results or am I completely missing something here?

 

 

 

See also https://devcentral.f5.com/wiki/AdvDesignConfig.HTTPMonitor_cURL_BasicPOST.ashx

 

 

 

 

 

 

Matt

 

2 Replies

  • mkahler_108475's avatar
    mkahler_108475
    Historic F5 Account
    You are correct. The LTM will kill the monitor as soon as standard out is received. I think there used to be a wrapper sciprt that would capture standard out and allow the script to finish. Your recommendation is correct. Do your house keeping prior to writting to standard out.
  • I thought we'd fixed that bug in all the codeshare entries, but apparently this one was missed. I updated it to remove the PIDFILE before echoing up.

     

     

    Thanks for pointing this out.

     

     

    Aaron