Forum Discussion
Ofir_73471
Nimbostratus
Jun 06, 2009Assistance with writing an External Monitor
Hi,
I need to sample my servers by sending a UDP packet and if i am getting an answer meaning the server is up .
i have used netcat and it works but i dnot know how to write the ...
hwidjaja_37598
Altostratus
Jun 07, 2009Try this:
!/bin/sh
Adopted from /usr/bin/monitors/sample_monitor
pidfile="/var/run/pinger.$1..$2.pid"
if [ -f $pidfile ]
then
kill -9 `cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
node_ip=`echo $1 | sed 's/::ffff://'`
nc -w -u -w 3 -o /root/x-reply.hex $node_ip $2 < /root/x.hex > /dev/null
status=$?
if [ $status -eq 0 ]
then
echo "up"
fi
rm -f $pidfile
Don't forget to make the script executable (e.g. chmod a+x
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