Forum Discussion
External monitor issues
I'm trying to get an external monitor working and not having much luck. This virtual server is meant to do per-packet UDP load balancing across two pool members. The health check's intent is to SSH into the pool members, run a script local to the pool member, and gauge the response to determine if the pool member should be marked available. Here's my setup:
Virtual server listening for UDP on all ports:
ltm virtual /Common/siem_gateway_vs {
destination /Common/172.22.237.100:0
ip-protocol udp
mask 255.255.255.255
pool /Common/siem_gateway_pool
profiles {
/Common/siem_udp { }
}
translate-address enabled
translate-port disabled
vlans {
/Common/syslog
}
vlans-enabled
}
A pool applied to the virtual server with two members:
ltm pool /Common/siem_gateway_pool {
members {
/Common/172.22.237.244:0 {
address 172.22.237.244
}
/Common/172.22.237.245:0 {
address 172.22.237.245
}
}
}
The members:
ltm node /Common/172.22.237.244 {
address 172.22.237.244
}
ltm node /Common/172.22.237.245 {
address 172.22.237.245
}
External monitor:
ltm monitor external /Common/splunk_forwarder {
defaults-from /Common/external
destination *:22
interval 5
run /Common/siem_da_healthcheck
time-until-up 0
timeout 16
}
And the script it runs:
!/bin/sh
remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)
IP=`echo ${1} | sed 's/::ffff://'`
PORT=${2}
set the pid file location and name
PIDFILE="/var/run/`basename ${0}`.${IP}.${PORT}.pid"
kill off the last instance of this monitor if hung and log current pid
if [ -f $PIDFILE ]
then
echo "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error
kill -9 `cat $PIDFILE` > /dev/null 2>&1
fi
echo "$$" > $PIDFILE
send request & check for expected response
ssh splunkf5@${IP} -i /config/ssh/ssh_host_dsa_key /home/splunkf5/healthcheck.sh 2>&1 > /dev/null
mark node UP if expected response was received
if [ $? -eq 0 ]
then
echo "UP"
fi
rm -f $PIDFILE
exit
I'm unable to get the F5 to even attempt an SSH connection with the health monitor above applied to the pool, or directly to the nodes themselves.
I suspect it may have something to do with having a wildcard port on the pool member, but the script shouldn't need the port to connect as it is specifying an SSH command. Any thoughts as to how I can get this to work?
4 Replies
- Kevin_Stewart
Employee
Silly question, but will this script work if you run it directly from the command line, with an IP address parameter? You're using an alias service port in your monitor so you shouldn't have an issue applying the monitor to your IP:0 pool. Otherwise, I've tested it on 11.3 and don't see anything specifically wrong with your config. I did make a minor modification though to react to a specific remote response vs. an exit status.!/bin/sh remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format) IP=`echo ${1} | sed 's/::ffff://'` set the pid file location and name PIDFILE="/var/run/`basename ${0}`.${IP}.${PORT}.pid" if [ -f $PIDFILE ] then kill -9 -`cat $PIDFILE` > /dev/null 2>&1 fi echo "$$" > $PIDFILE send request & check for expected response SSHRES=`ssh splunkf5@${IP} -i /config/ssh/ssh_host_dsa_key /home/splunkf5/healthcheck.sh` mark node UP if expected response was received if [ $SSHRES == "good" ] then echo "UP" fi rm -f $PIDFILE exit - Cory_50405
Noctilucent
I can't get it to run from a command line. Keep getting this:
line 23: syntax error: unexpected end of file
So the F5 configuration itself doesn't appear to be the problem at this point, just the script. Any ideas why the script may not be working? It was patterned after something pulled directly from the codeshare that Deb wrote. Only command different is that ssh line. - Kevin_Stewart
Employee
If you're trying to run it directly from the location that the GUI imports it (/config/filestore/files_d/Common_d/external_monitor_d/...), try making a local copy of the script and trying that version instead. Otherwise there aren't 23 lines in your original script. If you can get it to run locally form the command line then it should run within the monitor. - Cory_50405
Noctilucent
I had copied it over to /var/tmp and tried running it there to no avail. That's where I'd been doing all of my testing. After reading some more, I went back into /config/filestore/files_d/Common/external_monitor_d and ran the external monitor itself. From there, it worked. Seems it was a permissions issue of some kind, though I don't exactly know what. I have it all working now after hours of pulling my hair out. Thanks for the help Kevin.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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