Forum Discussion
Leon_Archambau1
Jan 29, 2014Historic F5 Account
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_Archambau1Historic 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
- PeteWhite
Employee
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects