[Xymon] mysql password file on centos 5, xymon client

Mike Burger Mike.Burger at FreedomMortgage.com
Thu Nov 29 13:49:09 CET 2012


Leon,

 

If you installed Xymon from RPM on your CentOS 5 system, and you run
either "finger xymon" or "grep xymon /etc/passwd", you'll likely note
that the xymon user's home directory is /usr/lib/xymon. Try
creating/moving the .my.cnf there.

 

From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf
Of Leon Volfson
Sent: Wednesday, November 28, 2012 7:21 AM
To: xymon at xymon.com
Subject: [Xymon] mysql password file on centos 5, xymon client

 

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




CONFIDENTIALITY NOTICE: This e-mail message, including all attachments, is for
the sole use of the intended recipient(s) and may contain confidential
information. Any unauthorized review, use, disclosure, alteration or
distribution is strictly prohibited and may violate state or federal law. If you
are not the intended recipient, please contact the sender by reply e-mail,
delete this email and destroy all copies of the message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20121129/4100c1e4/attachment.html>


More information about the Xymon mailing list