Forum Discussion

Leon_Archambau1's avatar
Leon_Archambau1
Historic F5 Account
Jan 30, 2014

Need to create a bash script to monitor the health of a tftp server

I have a need to monitor the health of a tftp server. I have tried using perl but LTM does not have the tftp module. I tried the script below, server went green for a couple of minutes, then the server hung up and I had to reboot.

 

2 Replies

  • Leon_Archambau1's avatar
    Leon_Archambau1
    Historic F5 Account
    !/bin/sh These arguments supplied automatically for all external monitors: $1 = IP (nnn.nnn.nnn.nnn notation) $2 = port (decimal, host byte order) Remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format) NODE=`echo ${1} | sed 's/::ffff://'` PORT=${2} remotefile="Health_Check.cm" localfile="Health_Check.cm" PIDFILE="/var/run/`basename ${0}`.${NODE}_${PORT}.pid" kill of the last instance of this monitor if hung and log current pid if [ -f $PIDFILE ] then echo "EAV exceeded runtime needed to kill ${NODE}:${PORT}" | logger -p local0.error kill -9 `cat $PIDFILE` > /dev/null 2>&1 fi echo "$$" > $PIDFILE /usr/bin/tftp $NODE -c get $remotefile $localfile 2>&1 | /bin/egrep -q "Error|timed" STATUS=$? rm -f $PIDFILE if [ $STATUS -eq 1 ] then echo "UP" fi Exit
  • 1) Test the tftp command yourself and check that it works correctly

     

    2) Take a tcpdump to see what happens when you run the script