[Xymon] mysql password file on centos 5, xymon client
Leon Volfson
leon at one.co.il
Wed Nov 28 13:21:15 CET 2012
Hi,
I have a question.
Recently I've added a script to monitor the mysql replication.
I got it off the internet:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
############################################################################################
test -e /usr/local/mysql/bin/mysql && PROG=/usr/local/mysql/bin/mysql
test -e /usr/bin/mysql && PROG=/usr/bin/mysql
MAXDRIFT=5
############################################################################################
MYSQLCOLOR=""
MYSQLLINE=""
HOSTIP=127.0.0.1
IPADDR=127.0.0.1
MACHINE=`uname -n`
MAXSEC=60
MYSQLUSER=root
MYSQLPORT=3306
LINE=`echo "show slave status \G" | ${PROG} -h ${HOSTIP} -u ${MYSQLUSER} -P
${MYSQLPORT} 2>&1`
MASTERPOS=`echo $LINE | grep Read_Master_Log_Pos | awk -F
'Read_Master_Log_Pos: ' '{print $2}' | awk '{print $1}'`
SLAVEPOS=`echo $LINE | grep -i Exec_Master_Log_Pos | awk -F
'Exec_Master_Log_Pos: ' '{print $2}' | awk '{print $1}'`
SLAVEUP=`echo $LINE | grep Running | wc -l`
SLAVE_SECOND_BEHIND_MASTER=`echo $LINE | grep 'Seconds_Behind_Master:' |
awk -F 'Seconds_Behind_Master: ' '{print $2}' | awk '{print $1}'`
test $SLAVEUP -eq "1" && DRIFT=$((${MASTERPOS} - ${SLAVEPOS}))
echo "${LINE}" | ${GREP} "Running: No" >/dev/null
if test "$?" -eq "0"
then
MYSQLCOLOR="red"
MYSQLLINE="`${DATE}` MYSQL Slave in error
${LINE}"
elif test ${SLAVEUP} -ne "1"
then
MYSQLCOLOR="green"
MYSQLLINE="`${DATE}` MYSQL Slave is Stopped
${LINE}"
elif test ${SLAVE_SECOND_BEHIND_MASTER} -ge ${MAXSEC}
then
MYSQLCOLOR="yellow"
MYSQLLINE="`${DATE}` MYSQL Slave is ${DRIFT} statements behind!
${LINE}"
else
MYSQLCOLOR="green"
MYSQLLINE="`${DATE}` MYSQL Slave is ${DRIFT} statements behind!
${LINE}"
fi
#echo "${BB} ${BBDISP} status ${MACHINE}.mysqlslave ${MYSQLCOLOR}
${MYSQLLINE}"
${BB} ${BBDISP} "status ${MACHINE}.mysqlslave ${MYSQLCOLOR} ${MYSQLLINE}"
-----------------
To make it working, you need to create the file : ~hobbit/.my.cnf
[mysql]
password=XXXXXXXX
[mysqlclient]
password= XXXXXXXX
[mysqladmin]
password= XXXXXXXX
[mysqlshow]
password= XXXXXXXX
[mysqldump]
password= XXXXXXXX
-------------------------------------------
chown hobbit: ~hobbit/.my.cnf
chmod 600 ~hobbit/.my.cnf
Add the section in clientlaunch.cfg
[mysqlslave]
ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
CMD $HOBBITCLIENTHOME/ext/mysqlslave.sh
LOGFILE $HOBBITCLIENTHOME/logs/mysqlslave.log
INTERVAL 5m
Restart hobbit-client.
------------------------------------------------------------------------------------------------------------------------
as you can see, the author instructs to put the .my.cnf file with all the
passwords in the ~hobbit/.my.cnf directory.
While that went fine on the Ubuntu 12.04 server, it doesn't work on the
CentOS 5 server.
I got the xymon client.rpm from some website and it just doesn't recognize
this file no matter where I put it.
The version is 4.3.10.
the client is installed in these directories:
/etc/xymon-client
/usr/libexec/xymon-client
/usr/share/xymon-client
I also noticed that there's no /var/lib/xymon-client directory.
The Ubuntu version was installed via apt-get and still has "hobbit" naming.
On CentOS client I renamed all the "hobbit" into "xymon".
If I put the pass into the script itself - it works. But I really don't
want to do that.
Any ideas?
Thanks,
Lenny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20121128/145e2ffb/attachment.html>
More information about the Xymon
mailing list