Forum Discussion

Angel_Martinez_'s avatar
Angel_Martinez_
Icon for Nimbostratus rankNimbostratus
Oct 05, 2009

MySQL Monitor EAV

Some previous releases BigIP LTM is using for internal features MySQL so we have available some MySQL tools like mysqlcheck ;o)

 

Using the EAV sample at /usr/bin/monitor/sample I have made this EAV monitor for checking my MySQL pools

 

[root@BIGIP:Active] log b monitor MySQL list

 

monitor MySQL {

 

defaults from external

 

args "USER PASSWORD DB"

 

run "mysql_check"

 

}

 

where mysql_check is:

 

[root@BIGIP:Active] log cat /usr/bin/monitors/mysql_check

 

!/bin/sh

 

 

these arguments supplied automatically for all external pingers:

 

$1 = IP (nnn.nnn.nnn.nnn notation or hostname)

 

$2 = port (decimal, host byte order)

 

$3 = Database Name

 

 

pidfile="/var/run/mysqlcheck.$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://'`

 

/usr/bin/mysqlcheck -h $node_ip -P $2 -u $3 --password=$4 -s -c $5

 

status=$?

 

if [ $status -eq " " ]

 

then

 

echo "up"

 

fi

 

rm -f $pidfile

 

echo "My log: IP-V6:$1 IP:$node_ip Port:$2 User: $3 Pass:$4 DB:$5" > /var/log/EXTERNAL.log

 

 

Have fun! ;o)