Forum Discussion

Narendra_26827's avatar
Narendra_26827
Icon for Nimbostratus rankNimbostratus
Sep 02, 2011

External Custom Monitor Script Help

Hello,

 

 

We have 5 different pools representing different service ports i.e. 8085, 8087, 8088, 8089 and 8091.

 

 

 

I have created a external custom shell script to monitor all these service ports.

 

 

 

The script is :

 

 

 

!/bin/sh

 

CHANNEL_RECV = normal (the expected channel response (not case sensitive))

 

GATEWAY_RECV = normal (the expected gateway response (not case sensitive))

 

SPACE_RECV = normal (the expected space response (not case sensitive))

 

 

 

NODE=`echo $1 | sed 's/::ffff://'`

 

 

 

pidfile="/var/run/umps_monitor.pid"

 

 

 

if [ -f $pidfile ]

 

then

 

kill -9 `cat $pidfile` > /dev/null 2>&1

 

fi

 

 

 

channel_status=`curl -fNs http://${NODE}:8085/api/channel/admin/monitor -d "data={xyz}" | sed 's/.*health":"\([^"]*\).*/\1/g' | grep -i "${CHANNEL_RECV}"`

 

 

 

gateway_status=`curl -fNs http://${NODE}:8085/api/gateway/admin/monitor -d "data={xyz}" | sed 's/.*health":"\([^"]*\).*/\1/g' | grep -i "${GATEWAY_RECV}"`

 

 

 

space_status=`curl -fNs http://${NODE}:8085/api/space/admin/monitor -d "data={xyz}" | sed 's/.*health":"\([^"]*\).*/\1/g' | grep -i "${SPACE_RECV}"`

 

 

 

if [ "$channel_status" == "normal" -a "$gateway_status" == "normal" -a "$space_status" == "normal" ]

 

then

 

echo "UP"

 

exit 0

 

else

 

exit 1

 

fi

 

 

 

rm -f $pidfile

 

 

 

 

From the above script i can determine the health of all the service ports. i.e. port 8085 to which request goes.

 

 

 

/api/channel/admin/monitor gives the health of port 8088 service.

 

 

 

/api/gateway/admin/monitor gives the health of port 8087 service.

 

 

 

/api/space/admin/monitor gives the health of port 8089 service.

 

 

 

 

 

Now in each pool i have added this monitor with availability requirement set to 1. If any of the service port is down the node should be mark as completely down in all the pools.

 

 

 

Now I am seeing Pool member monitor status up and down again and again very frequently in /var/log/ltm. Is there is something wrong with the script or i am making too much monitor noise with F5.

 

 

 

Please help.

 

 

 

Thanks.

 

 

 

  • Hi Narenda,

     

     

    You could add debug logging to the shell script to see what's occurring in the script when the pool members flap. You can use the logging in this Codeshare entry as an example:

     

    http://devcentral.f5.com/wiki/AdvDesignConfig.TemplateForExternalLtmMonitors.ashx

     

     

    You can also enable debug on the monitoring daemon, bigd, using 'b db bigd.debug enable|disable'. The output is logged to /var/log/bigdlog. The output can be very verbose, so disable the logging once you're done testing.

     

     

    But I think your scenario can be implemented with default monitors. You can set the alias port on the monitor(s) to the port you want the monitor to run against. Create one per HTTP request/destination port combination. Then add all of the monitors to each of the node addresses.

     

     

    Aaron