Forum Discussion
Clayton
Jun 08, 2021Altocumulus
MySQL Monitor (or EAV) with SSL?
We are migrating to MySQL, and I would like to use our F5 LTM to load balancer the ( MySql Enterprsie, 3-node) cluster. I have upgraded to Bigip 15.1.3 (from 14.x.x) per Support as version 15 should ...
Clayton
Jun 10, 2021Altocumulus
And so nobody else has to flounder like I did, here is the script.
- Import into File Management -> External Monitor Program File List
- Create health monitor -> External
- Set Interval and Timeout ( I am using 30/91)
- Select the script you created in step 1
- Add the following Variables
- Name: query , Value: select @@read_only;
- Name: result, Value: 0
- Name: pass, Value: <password here>
Value of 0 (zero) indicates Read/Write (Master) node, value of 1 (one) indicates read-only node.
Here is the script:
#!/bin/bash
# Name of the pidfile
pidfile="/var/run/$MONITOR_NAME.$1..$2.pid"
# Send signal to the process group to kill our former self and any children
# as external monitors are run with SIGHUP blocked
if [ -f $pidfile ]
then
kill -9 -`cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
# Remove the IPv6/IPv4 compatibility prefix
node_addr=`echo $1 | sed 's/::ffff://'`
# pass, query, and result are passed as variables
# from the Health Monitor definition
# Search the data received for the expected expression.
# Replace "<monitoring username here>" with the user you wish to log into mysql with
/bin/mysql -sN -u <monitoring username here> -p${pass} -h ${node_addr} -P $2 -e "${query}" 2> /dev/null | grep -E -i ${result} > /dev/null
status=$?
if [ $status -eq 0 ]
then
# Remove the pidfile before the script echoes anything to stdout and is killed by bigd
rm -f $pidfile
echo "up"
fi
# Remove the pidfile before the script ends
rm -f $pidfile
- Nikoolayy1Jun 10, 2021MVP
If even setting the Alias Ip addrress and alias port on the monitor to the VIP did not help then yes the external monitor is the best option thanks for sharing the script with the comunity.
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